What do you mean by handle ? Is target response giving 301 ? What would you like to do in Apigee ? What is the expected outcome ? I believe, your question is not complete. Please update your question with more details.
Redirect to where ? Apigee Edge Proxy just returns the same to the client. Client has to handle the redirect. Just think like your target is giving 301 , What would you like to do in Apigee ?
Apigee is just a target for your client view. Client has to handle redirects, Redirect in Apigee doesn’t make any sense. You need to send the response back to the client. Apologies, If i am missing something here.
If you mean, Making an API call to redirect URL from the target response, you can leverage Service Callouts. Ultimately, You need to send response back to client right ? What do you mean exactly when you said “Redirect in Apigee” ?
I agree Redirects are done from REST clients. .. but if I am getting the redirect URL in Response Headers .Location of apigee … then why can’t it be done from apigee itself instead of clients doing the same.
Problem here is for my proxy I am sending a OAuth access token as ‘Authorization’ header.
But my target URL also requires a ‘Authorization’ header which I am setting it internally as ‘Assign Message’ policy.
Now we cant send two different ‘Authorization’ header from rest client if you want rest client to handle the redirect.
@Atanu Mazumdar , Remove the Authorization header in Apigee Proxy flow after verifying access token using Assign Message Policy & then add target url related authorization header. Does that help ?
I am already adding target URL related authorization header in Assign Message.
Authorization header is getting set but how to do the redirect from target server(means again reset the target url which we are getting as part of Response Headers .Location).
@Atanu Mazumdar , I am missing something here, Client → Target → Target Response → 301 Response Header → Client → Clinet does Redirect.
What you are saying is ,
Client → Target → Target Response → 301 Response Header → Make an API call to the redirect URL → Get Response → Send to client ? Is it what you are expecting ?
@Atanu Mazumdar , It should be simple, Just execute a service callout on condition if target response is 301 & grab the url from response headers. And then send response from service callout to client. It’s called mashup & it’s available out of the box. Refer here for flow variables, Refer here for conditional execution of policy, Refer here for service callout.
@Atanu Mazumdar , I am missing something here, Client → Target → Target Response → 301 Response Header → Client → Clinet does Redirect.
What you are saying is ,
Client → Target → Target Response → 301 Response Header → Make an API call to the redirect URL → Get Response → Send to client ? Is it what you are expecting ?
It should be simple, Just execute a service callout on condition if target response is 301 & grab the url from response headers. And then send response from service callout to client. It’s called mashup & it’s available out of the box. Refer here for flow variables, Refer here for conditional execution of policy, Refer here for service callout.
@Atanu Mazumdar , Agree with you , Valuable & Valid points. Performance hit is minuscule, few ms while checking the condition, few more ms if we are making one more API call.