0

I am trying to set the _SERVER["HTTPS"] php variable to yes on my web servers.

Actually, https trafic come to stunnel which forward it to haproxy which forward it to my web servers running under nginx.

Trying to add this in haproxy.cfg:

    reqidel ^HTTPS:
    reqadd HTTPS:\ yes

But instead of clear HTTPS and add HTTPS to yes it adds a new variable:

_SERVER["HTTP_HTTPS"]

Any idea?

Regards,

Sairam
  • 1

1 Answers1

1

I suspect you really need X-Forwarded-Proto instead. This header is a convention by which the reverse proxy can tell the origin server that a connection was HTTPS, even if the connection between reverse proxy and origin server is not. Most common web applications already check for this header, and you can easily check for it in a custom web app.

reqadd X-Forwarded-Proto:\ https if { ssl_fc }
Michael Hampton
  • 237,123
  • 42
  • 477
  • 940