Hello!
So requests comes in:
GET […].apigee.net/proxy/dog
With […].apigee.net/proxy being the base path and /dog the suffix.
The target server is https://my-backend.com/
So far the above request would be routed to https://my-backend.com/dog
But I want that request to be routed to https://my-backend.com/cat!
The first idea is obviously https://docs.apigee.com/api-platform/reference/policies/assign-message-policy#set-path. But apparently that does not work and the recommended approach is to set target.url.
Like this:
# Proxy Endpoint / Conditional Flow for "dog"
<AssignVariable>
<Name>targetUrl</Name>
<Value>https://my-backend.com/cat</Value>
</AssignVariable>
# Target Endpoint / Post Flow:
<AssignVariable>
<Name>target.url</Name>
<Ref>targetUrl</Ref>
</AssignVariable>
Now my question is whether this is the recommended way to go for my use case?
I’m asking because having to handle the target server URL (https://my-backend.com/) there seems clumsy. Especially due to having to handle that target server URL as a global variable just to accomplish this feat - which as far as I can tell is pretty much as standard as it gets. Hence my confusion.
Cheers
Raffael