Tracing the redirected response in case of 302 from target

I have a target server that returns a 302 response. The client using this proxy gets a 200 which is the response from the redirected URL.

When I trace this request in debug session, it always shows 302 but not the redirected response which is actually 200. I also need the redirected response status to use for logging. The "response" does not provide this information, instead it's always 302.

How do I get access to redirected response status/content to use in the next policy?

Solved Solved
0 2 281
1 ACCEPTED SOLUTION


@gagantk wrote:

How do I get access to redirected response status/content to use in the next policy?


You cannot. If I am understanding correctly, the client connects with Apigee, which proxies to a target. The target returns a 302, which Apigee then relays to the original client.  The client, if it follows redirects, will simply invoke that target. If the Location header points to target2.something.com, the client will connect with that target directly. It won't go through Apigee, if that location URL points to something else. 

Like this: 

Apigee in 302.png

If you want the 2nd request by the client to be managed by Apigee, then... you need to insert logic in the Apigee response flow to  modify the Location header before it gets sent to the client.  The modified Location should point to an Apigee endpoint, at which you have a proxy that can proxy to target2. 

I hope this is clear. 

View solution in original post

2 REPLIES 2


@gagantk wrote:

How do I get access to redirected response status/content to use in the next policy?


You cannot. If I am understanding correctly, the client connects with Apigee, which proxies to a target. The target returns a 302, which Apigee then relays to the original client.  The client, if it follows redirects, will simply invoke that target. If the Location header points to target2.something.com, the client will connect with that target directly. It won't go through Apigee, if that location URL points to something else. 

Like this: 

Apigee in 302.png

If you want the 2nd request by the client to be managed by Apigee, then... you need to insert logic in the Apigee response flow to  modify the Location header before it gets sent to the client.  The modified Location should point to an Apigee endpoint, at which you have a proxy that can proxy to target2. 

I hope this is clear. 

Thanks for the detailed explanation.