Traefik如何使用docker中的端口和路径从后端服务xteve进行路由
我正在尝试使用Traefik 2.6.3在Docker中运行XTEVE的反向代理,但是我会使用一些中间Wares。
默认情况下,XTEVE在端口34400上聆听以连接到DVR IP:
IP: 192.168.96.2:34400
它还具有Web UI的A /Web路径:
web Interface: http://192.168.96.2:34400/web/
如果我只使用“ traefik.http.routers.xteve.rule.rule = host = host(`my_hostname`my_hostname` )“
实际上我可以使用https:// my_hostname
轻松地通过WebUI访问它,然后将其重定向到https://my_hostname/web
。
我正在尝试对另一个服务进行反向代理,该服务实际上具有与/web
在其服务中相同的前缀,因此存在冲突。这就是为什么我想从Xteve中删除/web
,并用/XTEVE
替换。
我似乎根本无法做到这一点。如果我替换为/XTEVE
,我可以成功连接到服务,等同于连接到IP 不是,如上所述。因此,我真的不确定为什么我不能连接到Web界面,我确实尝试了/XTEVE/WEB
,但这仍然不会放回Web UI,与<<代码>/XTEVE 将。
我已经尝试剥离前缀,更换前缀,regex替换,使用path
和pathprefix
但仍然没有运气,请参阅下面的评论:
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"
我显然缺少某些东西,但是不确定什么并寻求一些帮助。这些文档并不那么清楚,我似乎只找到了Traefik V1的东西。
如果有人能提供帮助 - 谢谢。
编辑: 我想我真正的问题是,如何将后端服务从&lt; ip&gt;:&lt; port&gt;/&lt; path&gt;
&lt; fqdn&gt;/&gt;/&gt;/&lt; /代码>在Traefik中。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论