hi,

Can haproxy support following backend scenario?

- use HTTP CONNECT to establish a proxy connection
- send custom HTTP header with the CONNECT method
- then switch to tunnel mode to allow custom TLS protocol through

I've not found anything really useful in RFC7231 whether this
is a common scenario, and while trying to implement this with
haproxy, I either land on:

- add headers in `mode http`, but can't handle TLS protocol
- use `mode tcp`, but then can't add custom header

https://www.rfc-editor.org/rfc/rfc7231#section-4.3.6 


## haproxy.cfg snippet

frontend tunnel80_fe
        bind 10.0.0.1:80
        mode http
        ## strictly speaking the headers aren't part of CONNECT
        http-request set-header Authorization "Bearer mytoken123"
        default_backend tunnel80_be

backend tunnel80_be
        mode http
        server tunnel80 remote.ip:12345

frontend tunnel443_fe
        bind 10.0.0.1:443
        mode tcp
        ## ignored because we're in tcp mode
        http-request set-header Authorization "Bearer mytoken123"
        default_backend tunnel443_be

backend tunnel443_be
        mode tcp
        server tunnel443 remote.ip:12346

A+
Dave

Reply via email to