Application Gateway causing login to fail with a 405 error

Anonymous
2022-03-01T16:50:13.467+00:00

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?:
178955-image.png

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,217 questions
0 comments No comments
{count} votes

Accepted answer
  1. SaiKishor-MSFT 17,336 Reputation points
    2022-03-01T21:16:00.747+00:00

    @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:

    1. https://learn.microsoft.com/en-us/azure/application-gateway/application-gateway-backend-health-troubleshooting
    2. https://kinsta.com/blog/405-method-not-allowed-error/
    3. https://mkyong.com/servlet/http-status-405-http-method-get-is-not-supported-by-this-url-servlet/

    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!
    Remember:

    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
    2022-03-02T14:46:04.197+00:00

    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
    2022-03-02T10:13:44.517+00:00

    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
    2022-03-02T11:18:22.323+00:00

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

    0 comments No comments

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.