3

In my Apigee API Proxy, I need to get the environment URL that is defined in my configuration, so that I can send it as part of the response.

For example: http://myorg-test.apigee.net/pricing

However, when I try to get it using proxy.url, I get an aliased path, like http://rrt18apigee.us-ea.4.apigee.com/pricing

Currently, I'm trying to get it like:

var response = {
    proxyUrl : context.getVariable("proxy.url"),
};
Victor Lyuboslavsky
  • 9,882
  • 25
  • 87
  • 134

1 Answers1

2

Here is a work around. You can try to get the following variables and create the entire URL

  • Get the request scheme (http or https) from request.Headers.X-Forwarded-Proto (if you are using cloud version) or client.scheme if you are using on-prem
  • Get the host name from request.host
  • Get the entire request path from request.path
  • Entire list of URL query params and list from message.querystring

You can then construct the entire request URL.

( I know this should not be this painful. Please log a bug in case proxy.url is really broken. )

Santanu Dey
  • 2,900
  • 3
  • 24
  • 38