I need to connect the tenants of my app to the domain with /path/to/slot/ via traefik
I do have up and running:
docker swarm mode running
with dashboard & portainer & with letsencrypt certbot /ssl
& with the "index-login-php-lamp-app" running on the master-node. (with redis for the PHP $_SESSION vars running on a worker-node & with a sticky-flag for the defined cookie (via treafik.labels. .. defined in my compose.yml ...)
the label defined for making the connection is as follows:
- traefik.http.routers.pathtoproject-websecure.rule=Host(`mydomain.xyz`) && Path(`/path/to/project`)
(later, I want to set the /path/to/project via env var and point to the tenant's instance that way...)
Portainer (again: running ob the master-node) tells me: all fine - service and container on the defined (via constraint) worker-node is up and running → so there must be some connection
traefik-Dashboard is fine as well:
mydomain.xyz/path/to/project/ all I get is a 404 "Apache/2.4.51 (Debian) Server at mydomain.xyz Port 80" // I think, this is the Apache running on the master and not the one of the worker, btw ...)
the network I use /want to use for connecting the containers & services via traefik ("cloud-public" overlay network) is available on both nodes (docker network ls i same ID); BUT: network inspect ['the NETWORK ID'] shows me different results for the containers. (only those running on the node. Is this the sign of an error, or normal behavior? ) ... actually, I's expect not only to see the Peers (what I see, with the node's IPs), but all the containers connected with the network via these nodes ...
"Id": & "Created:" values of the network(s?) "cloud-public" are different on both nodes!
→ is this normal behavior, or a sign that I do have two different networks with the same name ?
... If you have some ideas / links with info, preferable with some comments: might be useful for me and for others (traefik & docker swarm has not too many info / examples / tutorials yet ...)
since I have portainer up and running via subdomain, I did deciede to stick with this design and created another subdomain and it works there - BUT only WITHOUT PATH:
- || - traefik.http.routers.pathtoprojecttest-websecure.rule=(Host(
is working fine ...
...but, when I add the path:
a.mydomain.xyz) && Path(
(info: the quotation marks are cut out here ...)
→ it does not work. "404 page not found".
..I did try it with Path and with PathPrefix: not working, 404.
sub.domain/path/index.php works not
... documentation is a bit poor here, isn't it? (there are still some older , yet unsolved questions in stack overflow with the same problem ...
working .replacepathregex. example:
(info: I am fixing the instances / tenants to specific nodes - so when one customer is "playing stupid" it's only his node which is affected ... performed via constraint of the service, btw..)
---------------- eg :: start: with dummy-path: /pathtotenant --------
- "traefik.http.routers.serviceInstance_001-web.rule=Host(`domain.abc`) && PathPrefix(`/pathtotenant`)"
- "traefik.http.routers.serviceInstance_001-web.middlewares=serviceInstance_001-replacepathregex, serviceInstance_001-redirectregex" # these are the both below!
feel free to add another, perhaps better solution or "just your way of doing it" - or just add some comment & feedback!
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.