I have a requirement where I want to create an API Proxy with proxy base path not same is target end point. I mean , we have the following scenario
Get Access Token - HTTP POST
Content Type: application/x-www-form-urlencoded
Target Endpoint: http://test.com:8080/authn/oauth2/healthcare/access_token?grant_type=password&username=test&password=test
External URL (Proxy Base Path): /authentication/access_token
So when I hit the proxy base path , it should be directly replaced by target endpoint
When I tried to create one, request sent to target is not correct, it's getting repeated.
Attaching the proxy and the trace.
Please let me know what is missing/incorrect
Hi @GAURAV
Please see this answer: https://community.apigee.com/questions/18339/how-to-remove-pathsuffix-from-being-forwarded-to-t.html
You are looking for
context.setVariable("target.copy.pathsuffix", false)
Many thanks, Sean
It's not working , please find attached api proxy bundle and trace
Thanks
Hi @GAURAV
Please include the following line in your JavaScript policy
context.setVariable("target.copy.queryparams", false);
The one you have is for path parameters whereas the pass through is happening for the query parameters. For the list of Variables, check this link
NOTES:
1) Looked at your trace. Its not a good idea to pass all these sensitive info as query parameters. Please change them to urlencodedform parameters
2) Also found that the proxy is deployed on default vhost. Please change that to secure so its available only on https and NOT http. Thats OAuth2.0 standard and more secure
Hope this helps
Hi @GAURAV - Did that resolve the issue ? If yes, please accept the answer
User | Count |
---|---|
2 | |
1 | |
1 | |
1 | |
1 |