Re: PROXY protocol and setting headers X-Forwarded-Protocol=https ou X-Forwarded-Ssl=on

From: Willy Tarreau <w#1wt.eu>
Date: Sun, 18 Sep 2011 12:17:53 +0200


Hello Sebastien,

On Sat, Sep 17, 2011 at 01:27:22PM +0200, Sebastien Estienne wrote:
> Hello,
>
> I'm using stud with haproxy 1.5 in front of a gunicorn/django webapp.
>
> Django looks for X-Forwarded-Protocol=https ou X-Forwarded-Ssl=on
> headers to know if the request is secure or not.
>
> I guess it is the job of haproxy to set and forward these headers, but
> i don't really know on which condition/acl i should set these headers?
>
> Maybe using the source port of the request (443) as set by stud in the
> PROXY protocol, but is it exposed in haproxy config?

You mean the destination port, but yes I agree. You should proceed like this :

      reqadd X-Forwarded-Protocol:\ https if { dst_port 443 }

The dst_port will of course have been fed by stud using the proxy protocol.

Regards,
Willy Received on 2011/09/18 12:17

This archive was generated by hypermail 2.2.0 : 2011/09/18 12:30 CEST