1 year ago

#388069

test-img

Tom

Traefik how to route from a backend service xteve with a port and path in docker

I'm trying to run a reverse proxy for xTeVe in docker using Traefik 2.6.3, however I'm getting stuck with using some of the middlewares.

By default xTeVe listens on port 34400 to connect to the DVR IP:

IP:                 192.168.96.2:34400

It also has a /web path for the the web UI:

web Interface:          http://192.168.96.2:34400/web/

If I just use "traefik.http.routers.xteve.rule=Host(`MY_HOSTNAME`)" then actually I can access it easily via the webui using https://MY_HOSTNAME which then redirects to https://MY_HOSTNAME/web.

I'm trying to do a reverse proxy on another service which actually has the same prefix as /web in it's service, so there is a conflict. This is why I wanted to remove /web from xTeVe and replace that with /xteve.

I can't seem to get that working at all. If I do a replacement to /xteve I can successfully connect to the service which is equivalent of connecting to the IP not the web Interface as I described above. So I'm really not sure why I can't connect to the web interface, I did try /xteve/web but that still doesn't give the web ui back, just the same webpage as /xteve would.

I've tried stripping the prefix, replacing the prefix, regex replace, using Path and PathPrefix but still no luck, see comments below:

 labels:
      - "traefik.http.routers.xteve.rule=Host(`MY_HOSTNAME`)"
      - "traefik.enable=true"
      - "traefik.http.routers.xteve.tls=true"
      - "traefik.http.routers.xteve.entrypoints=websecure"
      - "traefik.http.services.xteve.loadbalancer.server.port=34400"
 #      - "traefik.http.middlewares.xteve-stripprefix.stripprefix.prefixes=/web"
 #      - "traefik.http.middlewares.xteve-addprefix.addprefix.prefix=/xteve"
 #      - "traefik.http.routers.xteve.middlewares=xteve-stripprefix"
 #      - "traefik.http.middlewares.test-redirectregex.redirectregex.regex=^http://192.168.96.2:34400/web/"
 #      - "traefik.http.middlewares.test-redirectregex.redirectregex.replacement=https://MY_HOSTNAME/xteve"
 #      - "traefik.http.middlewares.test-replacepathregex.replacepathregex.regex=^/web/(.*)"
 #      - "traefik.http.middlewares.test-replacepathregex.replacepathregex.replacement=/xteve/$$1"

I'm clearly missing something, but not sure what and looking for some help. The docs aren't really that clear and I seem to only find things that are for Traefik v1.

I'd be grateful if anyone can assist - thanks.

Edit: I guess my real question is, how do I change a backend service from <IP>:<PORT>/<PATH> to <FQDN>/<NEW_PATH> in traefik.

docker

docker-compose

proxy

reverse-proxy

traefik

0 Answers

Your Answer

Accepted video resources