Solved Solved

Use of variable in HTTPTargetConnection.URL

pdhandapani
Participant I

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 2,005
1 ACCEPTED SOLUTION
Solved Solved

gnanasekaran
Staff

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

Solved Solved
0 2 10
5 REPLIES 5
Solved Solved

gnanasekaran
Staff

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

Solved Solved
0 2 11

pbhogill

@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.

0 0 10

dey_santanu

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

0 0 10

nmunro
Participant III

Hi @Praveen Dhandapani,

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

Understanding routes

1 0 10

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);

0 0 10
Top Labels in this Space
Top Solution Authors