Different target urls for each environment in a single proxy.

Hi,

I got a proxy where we got 3 different environments and each environment should hit a different target.

The targets looks something like this: https://server_test:8443/test_v0/api and https://server_qa:8443/qa_v0/api. 'test' and 'qa' are variables that should be different for each environment.

I've tried:

https://server_qa:8443/{environment}_v0/api and it works but when also making the hostname a variable: https://server_{environment}:8443/{environment}_v0/api will generate the error:

{
    "fault": {
        "faultstring": "The Service is temporarily unavailable",
        "detail": {
            "errorcode": "messaging.adaptors.http.flow.ServiceUnavailable"
        }
    }
}

I made a question earlier: https://community.apigee.com/questions/66522/using-kvm-in-target-endpoint-doesnt-work.html but didn't really know the reason of it. But it seems like variables in the hostname is not allowed. Which was also the case in the previous question.

I've also tried using Target Servers, but it abit limited because I've a suffix in my url.

Is my goal achievable?

Solved Solved
0 2 752
1 ACCEPTED SOLUTION

@Ben Yuen

Target servers are the recommended way to achieve your requirement. It should work with the suffix given in the <Path> tag.

What's the issue you faced with adding the suffix?

View solution in original post

2 REPLIES 2

@Ben Yuen

Target servers are the recommended way to achieve your requirement. It should work with the suffix given in the <Path> tag.

What's the issue you faced with adding the suffix?

Thanks, Target servers works, I had a typo in my path.

Here's how I've set it up.

    <HTTPTargetConnection>
        <Properties/>
        <LoadBalancer>
            <Server name="targetUrl"/>
        </LoadBalancer>
        <Path>/{environment}_v0/api</Path>
    </HTTPTargetConnection