Hi, first post here so if I miss anything just let me know.
I'm running a simple URL shortener backend I made which was earlier on a VPS and I moved it over to a container based solution with traefik in front, it works great.
Now my friend wanted the same setup, so I more or less duplicated that container setup, switched the router and service names in the labels (and what database it uses, but should be irrelevant here) and switched the router host rule to match his domain, but that second setup is getting a 404, where as my original one works without issue.
I feel like I have tried everything and am at a complete loss here, any help is greatly appreciated, below are the labels (only router name and domains switched, I have made sure this is not a case of a typo).
My container:
-- "traefik.enable=true"
-- "traefik.http.routers.myshortener.rule=Host(`example.com`)"
-- "traefik.http.routers.myshortener.entrypoints=websecure"
-- "traefik.http.routers.myshortener.service=myshortener"
-- "traefik.http.routers.myshortener.tls.certresolver=cl_resolver"
-- "traefik.http.services.myshortener.loadbalancer.server.port=4242"
And here is the setup for my friends one:
-- "traefik.enable=true"
-- "traefik.http.routers.friendsshortener.entrypoints=websecure"
-- "traefik.http.routers.friendsshortener.rule=Host(`short.example.com`)"
-- "traefik.http.routers.friendsshortener.service=friendsshortener"
-- "traefik.http.routers.friendsshortener.tls.certresolver=cl_resolver"
-- "traefik.http.services.friendsshortener.loadbalancer.server.port=4242"
As you can see the only real difference is that my friends one uses a subdomain and mine does not.
For reference I can see both of them show up in the traefik dashboard, both the routers and services, but in the access log if I go to my friends one it does not show his router and for mine it does. See below.
Mine:
[11/May/2021:09:02:36 +0000] "GET / HTTP/1.1" 200 31 "-" "-" 1112 "myshortener@docker" "http://172.18.0.5:4242" 1ms
My friends:
[11/May/2021:09:04:00 +0000] "GET / HTTP/1.1" 404 19 "-" "-" 1115 "-" "-" 0ms
My guess would be it has to do with the Host rule in some way? Since it seems like traefik does not want to route it properly and instead gives a 404, but I do not see what can be wrong with the rule, it is identical to many others I have that use subdomains and they all work fine.