I want to dynamically route to different target endpoints to different environments (dev,qa and uat ) based on a header parameter. For eg, if the header has value env = qa , it should be routed to the respective QA target endpoint. Similarly for all other environments.
Please let me know can I achieve this. I would like to achieve this without the creation of target servers.
explicitly set target.url in a policy, somewhere in the target request flow. This will implicitly override any target url you have specified in the HTTPTargetConnection. For example, suppose you have this in your target:
Please let me know where I am going wrong. Also, can I add more target endpoints in the http target configuration ? This is required since one environment has 2 target servers
There is a JS policy that will randomly select one of three target URLs . The proxy will respond with different responses depending on which target has been selected. Also see the injected response header, x-chosen-header, which indicates the selected target.
Glad to know, Please accept the answer by clicking on Accept link below the answer so that it will be also helpful for others. It’s the way to recognize best answer and gives credit to the user who answered same. Thank you.
I’m trying the option 2, however the variables are not getting replaced.
I have to go with this option as I have SSLInfo block as well, so JS target.url option doesn’t fit here.. and this option 2 doesn’t really replace the variables.