Can i change the resource name through route rule?

Not applicable

If my default target is http://httpbin.org

then my http://myproxy/get points to http://httpbin.org/get

can use route rule to take the following condition

<Condition>(proxy.pathsuffix MatchesPath "/mock")</Condition>

and make http://myproxy/mock to point http://httpbin.org/get

Solved Solved
0 2 171
1 ACCEPTED SOLUTION

Hi @Ravi Teja Darapu,

Route rules are used to route the request to different target systems altogether.

Example: If you want to route request like http://myproxy/fb to http://facebook.com and http://myproxy/google to http://google.com/ then you can use route rules in your proxy endpoint definition.

It looks like you just want to change the proxy.pathsuffix.

If you want to do so then create a conditional flow in your default target with the condition:

<Condition>(proxy.pathsuffix MatchesPath "/mock")</Condition>

And build target URL from a javascript callout like below:

var targetUrl = context.getVariable("target.url");
targetUrl = targetUrl + "/get";
context.setVariable("target.url", targetUrl);

Hope this is helpful!

View solution in original post

2 REPLIES 2

Hi @Ravi Teja Darapu,

Route rules are used to route the request to different target systems altogether.

Example: If you want to route request like http://myproxy/fb to http://facebook.com and http://myproxy/google to http://google.com/ then you can use route rules in your proxy endpoint definition.

It looks like you just want to change the proxy.pathsuffix.

If you want to do so then create a conditional flow in your default target with the condition:

<Condition>(proxy.pathsuffix MatchesPath "/mock")</Condition>

And build target URL from a javascript callout like below:

var targetUrl = context.getVariable("target.url");
targetUrl = targetUrl + "/get";
context.setVariable("target.url", targetUrl);

Hope this is helpful!

Thank you this helps a lot.