Application gateway not added x-forwarded-proto request header

Will Ang 20 Reputation points
2024-09-30T11:22:35.99+00:00

Application gateway front listener listen https, the backend is a container app, the backend setting listen http, when use custom domain of application gateway public ip to visit the container app web application encounter the following error, and the application trace shoulds x-forwarded-proto, x-forwarded-for, x-forwarded-host are all null,

"

jquery.min.js:2 Mixed Content: The page at 'https://simpleregimen.com/login.html?requestedUrl=http%3A%2F%2Fsimpleregimen.com%2Fem' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://simpleregimen.com/em?_=1727336261383'. This request has been blocked; the content must be served over HTTPS."

3ccf2f8cb5e47f2ee5ee4c45f9e62afa

it seems Application gateway not worked as the document say

Application gateway inserts six additional headers to all requests before it forwards the requests to the backend. These headers are x-forwarded-for, x-forwarded-port, x-forwarded-proto, x-original-host, x-original-url, and x-appgw-trace-id. The format for x-forwarded-for header is a comma-separated list of IP:port. https://zcusa.951200.xyz/en-us/azure/application-gateway/how-application-gateway-works#modifications-to-the-request

I tried add rewrite set to the rule, but still not work, is this a bug in the application gateway or does it require additional configuration? Thanks!

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,071 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Will Ang 20 Reputation points
    2024-10-11T13:58:27.8566667+00:00

    Hi, Rohith Vinnakota

    Thank you very much for your reply!

    I wrote a simple Spring Boot demo app, built it into a Docker image, and deployed it as a container app with an application gateway on Azure. According to the logs from the container app, headers like x-forwarded-proto are still null. I can't figure out where the configuration might be wrong. Below are the specific configuration screenshots. Could you help me determine where the configuration might be incorrect? I would be extremely grateful, as this issue is driving me crazy.

    Container app ingress:

    User's image

    application gateway listener:

    User's image

    application gateway backend pool:

    User's image

    application gateway backend setting:

    User's image

    container app log when doing redirect:

    User's image

    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.