Facing Issues with Mutual TLS Configuration for Specific Routes in Azure Application Gateway

Ganesh Chowdhary 0 Reputation points
2024-12-30T15:56:54.7966667+00:00

We need to support two APIs accessible through the domain device-api-server.com using Azure Application Gateway:

Bootstrap API

Path: /api/bootStrap Request Method: POST Authentication: No authentication required.

Handshake API

Path: /api/v2/handshake Request Method: POST Authentication: Requires mutual TLS (SSL validation). Current Setup:

We created two listeners in the API Gateway configuration:

Bootstrap-Listener: Listens on device-api-server.com. No certificate validation is required. Path Forwarding Rules: Requests to /api/bootStrap are forwarded to the backend pool onboarding-service. Requests to /api/v2/handshake are routed to the Handshake Listener.

BootStrap-Listener

image (8) bootStrap Rule

bootstrap_rule

handshake listener

image (9)

handshake rule

handshake_rule

Issue: When a request is sent to the Handshake API via the Handshake Listener, the response is:



  
    
    
  
  
    <h2>Length Required</h2>
    <hr>
    <p>HTTP Error 411. The request must be chunked or have a content length.</p>
  

It looks like Content-length header is getting dropped when Path Rule "/api/v2/handshake" is forwarding the request to Handshake-Listener"

Requirement:

How can we configure Azure Application Gateway to ensure:

The Bootstrap API remains accessible without authentication?

The Handshake API performs mutual TLS validation while avoiding the HTTP 411 "Length Required" error

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,106 questions
Azure Load Balancer
Azure Load Balancer
An Azure service that delivers high availability and network performance to applications.
466 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Ganesh Patapati 2,825 Reputation points Microsoft Vendor
    2025-01-09T16:10:23.0966667+00:00

    Hello Ganesh Chowdhary

    We appreciate your Patience!

    If we add it in the path-based rule, The API works fine but it does not validate the SSL Profile. APIs are working without certificates.

    you should not use in the Path based rule; you should have to be used in the redirect rule that's it. If you want MTLS to happen then you should not use path-based rule, you redirect to the listener which has MTLS, where only listener as MTLS. Mtls

    In this diagram, when using a listener with no MTLS, if you are implementing a path-based rule, it will directly route through the backend without MTLS. This flow respects the listener configuration. If redirection occurs, you will encounter another listener with MTLS, as shown in the diagram, which will route to a different backend that supports MTLS.

    However, in this case, the traffic first goes to the app gateway listener, which then directs it to another listener. Ideally, the flow should route directly to the backend via the path-based rule. Instead, it goes to the client, then to another listener where a 307 redirect sent by the app gateway is handled by the client. This does not work because path-based rules only respect listeners with MTLS configuration.

    NOTE: Path based rule will respects its listeners MTLS better go with redirection and make your clients supports 307.


    If above is unclear and/or you are unsure about something add a comment below.

    Please don’t forget to close the thread by clicking "Accept the answer" wherever the information provided helps you, as this can be beneficial to other community members.

    Regards,

    Ganesh


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.