Application Gateway causing login to fail with a 405 error


When running a 3rd party application through an App Gateway, I get a 405 error when trying to log in. This does not happen when no App Gateway is present. How can I fix this?:

Azure Application Gateway
Azure Application Gateway
An Azure service that provides a platform-managed, scalable, and highly available application delivery controller as a service.
979 questions
0 comments No comments
{count} votes

Accepted answer
  1. SaiKishor-MSFT 17,211 Reputation points

    @Anonymous Thank you for reaching out to Microsoft Q&A. I understand that you are having issues with accessing your application when it's behind the Application Gateway where it is throwing error 405 Not Allowed. Whereas accessing it directly does not cause any issue. Please correct me otherwise.

    **405 Error- Method not allowed- The method received in the request-line is known by the origin server but not supported by the target resource. **

    In order to troubleshoot this, I would start with looking at the Backend health logs to understand if the backend is throwing this error or the Application Gateway. Please go ahead and enable Backend access logs as per steps provided here. Once you have the same, please share it with us for further troubleshooting.

    In the meanwhile, please refer to these Microsoft/3rd party sites that discuss why HTTP error 405 occurs and how to handle it:


    Hope this helps. Please do let us know if you have any further questions in the meanwhile and we will be glad to assist. Thank you!

    Please accept an answer if correct. Original posters help the community find answers faster by identifying the correct answer. Here is how.

    Want a reminder to come back and check responses? Here is how to subscribe to a notification.

    0 comments No comments

3 additional answers

Sort by: Most helpful
  1. Anonymous

    Looking at those logs, the backend pool is wrong. The path based rule in the App Gateway is routing to for the default pool for the login rather than the correct backend. I changed the order of precedence of the rules in the App Gateway and that's fixed it.

    Thanks for the help!

    1 person found this answer helpful.

  2. Anonymous

    You have understood the issue correctly.
    179261-pt1h-3.logHere's the access logs:

    Note that this is a json file which I renamed to .log to allow upload.

    Thanks for the help.

    0 comments No comments

  3. Anonymous

    Further info - the Application is running in AKS using the Application Gateway Ingress Controller (AGIC)

    0 comments No comments