Hi. This looks like a simple problem to solve but no clear method written up for a newbie. SSL offloading is configured firstly.
Two use cases: truenas web ui PLUS a webdav directory listing ("/a") like so...
(1) truenas.domain.com -> nas.domain.com:443
(2) truenas.domain.com/a -> nas.domain.com:8081/a
Now (1) works as expected, in that the browser eventually sees truenas.domain.com/ui/sessions/signin (ie. the sign in page if you're not signed in, and if you are signed in, the main landing page). There is an underlying rewrite but truenas does it.
(2) gives me "503 service unavailable". This is the PROBLEM.
What I have is as follows:
two backends:
name: truenas
address: nas.domain.com
port: 443
enc: yes
name: truenas_webdav
address: nas.domain.com
port: 8081
enc: yes
no ACLs or actions defined in backends.
Next, frontend:
ACLs
name: truenas
exp: host matches
not: no
value: truenas.domain.com
name: truenas_a_1
exp: path matches
not: no
value: /a
name: truenas_a_2
exp: path starts with
not: no
value: /a/
name: truenas_a_1_neg
exp: path matches
not: yes
value: /a
name: truenas_a_1_neg
exp: path starts with
not: yes
value: /a/
then, actions (frontend)
use backend truenas
cond: truenas truenas_a_1_neg truenas_a_2_neg
use backend truenas_webdav
cond: truenas_webdav truenas_a_1 truenas_a_2
So I thought these conditions would be explicit enough (if I translate all the above to logic). I was wrong.
I read posts where they talk about putting the negative rules, setting or replacing paths, playing around with rules in front as well as back, using custom rules, regexes, etc. To no avail.
What is missing from the config? The real end points do work independently, albeit with the expected cert warning.
Could the automatic /ui/ redirect be interfering?
Learning from these refs:
https://www.haproxy.com/blog/path-based-routing-with-haproxy
https://forum.netgate.com/topic/178410/how-to-make-haproxy-path-use-backend-including-links-scripts/4
https://forum.netgate.com/topic/185542/haproxy-add-folder-path-to-backend-ip-address/2
https://forum.netgate.com/topic/185741/configure-haproxy-backend-to-a-url-with-a-subdirectory
https://serverfault.com/questions/982324/how-to-use-http-request-redirect-or-http-request-set-path-in-haproxy