HTTP trigger does not handle redirects on external calling point

Jagjit Singh 0 Reputation points
2023-02-05T20:04:55.2333333+00:00

Hello all,

Please would someone be able to guide me on this issue? I am trying to send GET request to an external HTTP endpoint from Logic App. The authentication to this external endpoint is Basic with a username and password. However, this external endpoint seems to have an Access policy manager (F5) in front which redirects this request to another location along with cookie and session details (MRHSession). When I try this HTTP trigger from Logic App, it stops after the first redirect. However, when I try the same trigger from Postman, the Postman handles the redirect and it automatically tries the new location and cookies - and all goes well. There are three redirects for this single GET request - and Postman manages all these but HTTP trigger from Logic App can't?

One solution that I have been advised is to parse the HTTP header from the first GET request to get the location and cookie, and then create additional GET requests to follow through all the redirects. This may work but sounds more of a workaround. Isn't there a better way for Azure/Logic App to manage the redirects? Could I use Application Gateway or APIM or something similar for calling this external HTTP Endpoint?

I am hoping that someone has come across similar situation where external HTTPS endpoints have an Access policy manager and will be able to help me here.

Thank you for your time to review my questions and help.

Jagjit

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
3,542 questions
Azure Application Gateway
Azure Application Gateway
An Azure service that provides a platform-managed, scalable, and highly available application delivery controller as a service.
1,213 questions
{count} votes

1 answer

Sort by: Most helpful
  1. MayankBargali-MSFT 70,936 Reputation points Moderator
    2023-02-15T08:26:52.34+00:00

    @Jagjit Singh Thanks for reaching out. The logic app HTTP action will fail if the return code is other than 2xx and this is the expected behavior. The one possible solution to handle this is to configure the run after behavior for the failed HTTP action and check for the status code as 301 or some other code as per your HTTP call and then get the required details from the request and create a new request as you have mentioned. APIM would not be able to handle the redirects as it will return the same response as it is from your backend service. I am not an expert in application gateway but looking into the document it does handle the redirects and this may be possible by configure URL rewrite. I have added the azure application gateway tag for the expert to confirm if the redirects can be handled or not in application gateway as per your scenario.

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.