Jens
October 22, 2024, 7:00pm
1
The ip address of zabbix looks like the following xx.yy.zz.uu/zabbix.
I made a config.yml file with the following items
http:
#region routers
routers:
zabbix:
entryPoints:
- "https"
rule: "Host(`zabbix.mysite.com`)"
tls: {}
service: zabbix
services:
zabbix:
loadBalancer:
servers:
- url: "http://XX.YY.ZZ.UU"
this results in getting to the apache2 debian default page. Adding the path /zabbix, gets me to the login page.
I thought of adding the following part to the routers section
middlewares:
- add-zabbixpath
and the following to middleware section
add-zabbixpath:
replacePath:
path: "/zabbix"
results it adds /zabbix to the path but instead of connect to the login screen, I'm getting an error. Any ideas how to solve this ?
You get an error? "418 I'm a teapot", maybe?
Jens
October 23, 2024, 6:57pm
3
Thank you for your reply.
I tried in multiple browsers, and now I'm seeing that it please the path but i'm getting a strange login screen which doesn't let me login with my username and pw.
Not sure what's going. Any ideas ? Or workaround for that matter ?
It's the same old problem we discuss here every week: GUI web apps don't like path manipulation.
You can change the path of the first request with middleware, but the response html page will usually load dependencies with fixed paths, like /static/style.css
, which will not work anymore.
Either the GUI web app enables setting some kind of "base path", or you need to use a sub-domain to make it work.
Jens
October 23, 2024, 10:55pm
5
Thank you for your response. Could you please direct me to the relevant information related to sub-domains ?
Thank you so much
I don’t understand your question regarding sub-domain.
If you just have the issue that /
shows a server page and you want it to redirect single /
to /zabbix
, then you could add a separate router.
An adaption from a post from this week :
- "traefik.http.routers.zabbixroot.rule=Host(`example.com`) && (Path(`/`)"
- "traefik.http.middlewares.zabbixroot.redirectregex.regex=.*"
- "traefik.http.middlewares.zabbixroot.redirectregex.replacement=https://example.com/zabbix"
- "traefik.http.routers.zabbixroot.middlewares=zabbixroot"
- "traefik.http.routers.zabbixroot.service=noop@internal"
(Sorry, this is for CLI, you need to change it to yaml format.)
It creates a router and a middleware both with name zabbixroot
.
Only when /
is requested, it will tell the browser to change to /zabbix
. All other requests should go to their original path. Remove add-zabbixpath
middleware from other router.
Jens
October 24, 2024, 8:16am
7
thank you for your reply. I've tried to do the redirect in yaml but somehow i'm missing something because it doesn't execute it. Here is the code
zabbix:
entryPoints:
- "https"
rule: "Host(`example.com`)"
tls: {}
service: zabbix
zabbixroot:
entryPoints:
- "https"
rule: "Host(`example.com`) && Path(`/`)"
service: noop@internal
middlewares:
- zabbix-redirectregex
the service
zabbix:
loadBalancer:
servers:
- url: "http://XX.YY.ZZ.UU"
and the middleware itself
zabbix-redirectregex:
redirectRegex:
regex: ".*"
replacement: "https://example.com/zabbix"
Enable TLS on https entrypoint
or all dependent routers
.
Jens
October 24, 2024, 6:07pm
9
Sorry but how would this look like ? I looked at the documentation but couldn't really find what was applicable. Tried the below without success.
tls:
passthrough: true
Jens:
tls: {}
In one router
you enable TLS, not in the other.
Jens
October 25, 2024, 7:49am
11
That effectively did the trick. Thank you so much
system
Closed
October 28, 2024, 7:50am
12
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.