PiBa-NL / pfsense-haproxy-package-doc

55 stars 15 forks source link

Use UNLESS condition instead of default IF #17

Open cwegh opened 1 year ago

cwegh commented 1 year ago

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