pfsense-haproxy-package-doc icon indicating copy to clipboard operation
pfsense-haproxy-package-doc copied to clipboard

Use UNLESS condition instead of default IF

Open cwegh opened this issue 2 years ago • 0 comments

For r-proxying OnlyOffice docker I need to add some custom ACLs and conditions on the backend. I use the following example: https://github.com/ONLYOFFICE/document-server-proxy/blob/master/haproxy/proxy-https-to-http.cfg based on these patterns: https://helpcenter.onlyoffice.com/installation/docs-community-proxy.aspx

I am able to configure all via the GUI however I have no option to change the default IF condition to an UNLESS statement as described for OnlyOffice. Isn't there any option or am I missing something?

In the haproxy.cfg file the GUI configuration results in the following

acl existing-x-forwarded-host req.hdr(X-Forwarded-Host) -m found acl existing-x-forwarded-proto req.hdr(X-Forwarded-Proto) -m found http-request add-header X-Forwarded-Host %[req.hdr(Host)] if existing-x-forwarded-host http-request add-header X-Forwarded-Proto https if existing-x-forwarded-proto

What Onlyoffice describes but unable to configure

acl existing-x-forwarded-host req.hdr(X-Forwarded-Host) -m found acl existing-x-forwarded-proto req.hdr(X-Forwarded-Proto) -m found http-request add-header X-Forwarded-Host %[req.hdr(Host)] unless existing-x-forwarded-host http-request add-header X-Forwarded-Proto https unless existing-x-forwarded-proto

cwegh avatar Jan 11 '23 21:01 cwegh