Use of variable in HTTPTargetConnection.URL

I'm unable to use a variable for the field HTTPTargetConnection.URL for the hostname. If I set it to https://{SOME_VARIABLE}/. I get an error when using the proxy {"fault":{"faultstring":"The Service is temporarily unavailable","detail":{"errorcode":"messaging.adaptors.http.flow.ServiceUnavailable"}}}

If there is validation that needs to be done then it should happen on save, or deploy. Otherwise the proxy is in an inconsistent state. Regardless, I feel there should be a variable allowed here since we have a number of target endpoints (other than the default) which use the same host.

Solved Solved
1 5 3,299
1 ACCEPTED SOLUTION

I think its not supported, you can use variables for paths, but not for the host name. I think this helps the runtime to setup connection pools to targets.

If there is a need for multiple target servers with same host [assuming across proxies], then you might want to use Targetservers.

View solution in original post

5 REPLIES 5

I think its not supported, you can use variables for paths, but not for the host name. I think this helps the runtime to setup connection pools to targets.

If there is a need for multiple target servers with same host [assuming across proxies], then you might want to use Targetservers.

Former Community Member
Not applicable

@Praveen Dhandapani, I do not believe its supported. In addition to what @mukundha@apigee.com mentioned, another option is to set the target.uri property to the hostname you desire in a JavaScript policy.

If a JavaScript policy allows you to change the value, it makes sense that you should be allowed to change it from XML as well. Much more convenient

nmunro
New Member

Hi @Praveen Dhandapani,

Would using a Route Rule not allow you to achieve the same thing?

Understanding routes

Not applicable

Hi Praveen,

Use javascript policy and set target.url variable.

e.g.

var baashostname = context.getVariable("baashostname");

var baasorgname = context.getVariable("baasorgname");

var baasappname = context.getVariable("baasappname");

var targeturl = "https://"+baashostname+"/"+baasorgname+"/"+baasappname+"/termsandconditions";

context.setVariable("target.url", targeturl);