I am trying to make Nomad UI work when behind a Traefik reverse proxy that uses a path address. I want to use https://mydomain.com/nomad and similarly consul https://mydomain.com/consul
I have configured Nomad service in Traefik in the following way:
http:
middlewares:
nomad-strip:
stripprefix:
prefixes:
- "/nomad"
nomad-strip:
stripprefix:
prefixes:
- "/nomad"
nomad-trailingslash:
replacepathregex:
regex: "/nomad/(.*)"
replacement: "/$1"
consul-strip:
stripprefix:
prefixes:
- "/consul"
consul-trailingslash:
replacepathregex:
regex: "/consul/(.*)"
replacement: "/$1"
basic-auth:
basicauth:
users: "{{basic_auth_htpasswd}}"
routers:
nomad-router:
service: nomad-ui
rule: Host(`{{base_url}}`) && (PathPrefix(`/nomad`) || PathPrefix(`/nomad/{.*}`))
entryPoints:
- websecure
tls: true
middlewares:
- basic-auth
consul-router:
service: consul-ui
rule: Host(`{{base_url}}`) && (PathPrefix(`/consul`) || PathPrefix(`/consul/{.*}`))
entryPoints:
- websecure
tls: true
middlewares:
- basic-auth
services:
nomad-ui:
loadBalancer:
servers:
- url: "http://{{inventory_hostname}}:4646"
passHostHeader: true
consul-ui:
loadBalancer:
servers:
- url: "http://{{inventory_hostname}}:8500"
passHostHeader: true
Unfortunately when I try to open https://mydomain.com/nomad in my browser i get the following result:
To proove that my environment is well set I removed all middlewares and set Host(
{{base_url}})
only and then the UI loads up without issues, see:
Could somebody tell me what am I doing wrong with setting up reverse proxy behind a /path ? What’s the correct config for Nomad UI for reverse proxy behind a /path ?