HAProxy community

Redirect scheme https unless ssl_fc || map -m found


#1

Hi,

I’d like to redirect to https unless it’s already https or if the Host header is present in a map file and imagine that this would work (this is in the frontend):

redirect scheme https code 302 unless { ssl_fc || hdr(Host),map(no_tls.map) -m found }

…but it doesn’t. Can anyone tell me if it’s possible and if so how to do it?

I’ve also tried the following, but that doesn’t work either:

redirect scheme https code 302 unless { ssl_fc || hdr_dom(Host) foo.bar.org }

I’m using v1.8.14.

Thanks in advance,
Björn


#2

{ and } are delimiters for anonymous ACLs. Combining multiple anonymous ACLs therefor requires opening and closing each condition:

redirect scheme https code 302 unless { ssl_fc } || { hdr_dom(Host) foo.bar.org }


#3

Ah, of course! Many thanks! :smile: