What happens by to any resources, query params, headers, and request body in a request to an API proxy?

sgilson
Participant V

Are they all just passed through by default to the target endpoint?

For example, a request to my API proxy looks like this:

http://myOrg-prod.apigee.net/weather/forecastrss?w=12345678 

My TargetEndpoint specifies the <URL> of the backend service as:

http://yahoo.com/weather

When Edge makes the request to the backend service through the TargetEndpoint, does it by default:

  • Append the resource to the target endpoint request? In this case "/forecastrss"
  • Append all query params from the proxy request to the target endpoint request? In this case "?w=12345678"
  • Copy all headers from the proxy request to the target endpoint request?
  • Copy the request body, if any, to the target endpoint request?
  • Add any Apigee-specific headers to the request to the backend?

So, by default, would the request to my backed looks like this:

http://myOrg-prod.apigee.net/weather/forecastrss?w=12345678 

I know there are policies to manipulate the request, but I am interested only in the default action.

Thanks,

Stephen

Solved Solved
0 1 1,877
1 ACCEPTED SOLUTION

I think the answer is 'yes' to all your questions, except for the last one where you ask "would the request to my backend look like this".

In the case of the weather API example, the request that Edge sends to the backend (which I copied directly from the Trace tool) is this:

GET https://weather.yahooapis.com/forecastrss?w=12797282

The proxypath suffix, /forecastrss, is retrieved from the client request and appended to the target URL as are any query parameters. The various parts of a request (like proxypath suffix) are described here: http://apigee.com/docs/api-services/reference/variables-reference. Request headers (from the client) are also passed unchanged in the target request. If the request contains a body (like with a POST), that content will be passed to the backend unchanged.

As you mentioned, you can make changes to the request headers, query params, and message using policies, and those changes will be passed in the target request. And anything you intentionally remove will not be sent. You can use the AssignMessage policy to do these kinds of operations. JavaScript policies are also commonly used for this.

Hope this helps. Any other feedback/confirmation would be welcome.

View solution in original post

1 REPLY 1

I think the answer is 'yes' to all your questions, except for the last one where you ask "would the request to my backend look like this".

In the case of the weather API example, the request that Edge sends to the backend (which I copied directly from the Trace tool) is this:

GET https://weather.yahooapis.com/forecastrss?w=12797282

The proxypath suffix, /forecastrss, is retrieved from the client request and appended to the target URL as are any query parameters. The various parts of a request (like proxypath suffix) are described here: http://apigee.com/docs/api-services/reference/variables-reference. Request headers (from the client) are also passed unchanged in the target request. If the request contains a body (like with a POST), that content will be passed to the backend unchanged.

As you mentioned, you can make changes to the request headers, query params, and message using policies, and those changes will be passed in the target request. And anything you intentionally remove will not be sent. You can use the AssignMessage policy to do these kinds of operations. JavaScript policies are also commonly used for this.

Hope this helps. Any other feedback/confirmation would be welcome.