I was battling a 404 message on a page when I stumbled upon this problem. To be honest, it didn't occur to me at first that it would be possible, yet it is.
I have a test JS application running in a docker container, the traffic to which is being forwarded by Traefik.
I have several other services set up absolutely identically and they work as expected. This one, however, is not.
I have made the conclusion that the problem is with the domain name itself when I successfully accessed the app via a different domain by adding the Host() mask to the rule of the router.
The snippet of the config is below. app.eliminyro.com is working while viceartur.me does not. Both domains are pointing to the same IP address, btw.
Note: I have also tested it with a different .me domain - the result is the same: 404 error despite the configuration being identical.
I would really appreciate if you could help me out with this. The issue seems bizarre (at least to me), and I am not sure it can be solved on my side.
Something else is up with your configuration. Posting all of your configuration will help.
It is possible your http://viceartur is also returning the 404. Access log can help determine this(treafik_router_name is present if matched to a router), I like to use json format for this as lots of useful information is included by default.
Have you been able to open app.eliminyro.com?
It's the same router, as you can see. And it does open.
How come the .me domain doesn't?
Also, it's not a problem of http/https protocol. There is a middleware that redirects from http to https, which does not work with .me domain either (even though the chain is specified [chain-no-auth@file]).
As I mentioned, other routers work just fine, routing the traffic to other containers with no issues. The only difference is that the routers for those services are set to work with .com domains. Everything else is identical.
For example:
My apologies for my inattentiveness about http-to-https redirect. For whatever reason, that doesn't work. That's not really important at the moment.
Nevertheless, if you try viceartur with https, it'll show 404 while app.eliminyro shows a page. How is that possible?
I am not comfortable with providing the whole config. Feels like I've displayed more than I should've anyway.
Is there something specific I can look at?
In traefik settings, routers are responsible for routing traffic, aren't they? The yaml is formatted as expected, otherwise it would not work or error out.
As for logs: this router is not mentioned in the access log anywhere.
It is mentioned in the debug though, it is seen there:
Okay, I have tested a couple of more domains with the same service, on different routers. .com work. .me, again, do not.
I am at my wit's end here.
This is absolutely mind-boggling. If anyone can suggest me something, I'd appreciate it.
Thanks in advance.
Thanks for your input.
The root of my problem isn't with the fact that domains point to different IPs, that was done on my side while I was trying to figure out the reasons behind the behavior.
The problem is in cloudflare processing .com and .me domains differently, for whatever reason. When I disabled its features for .me domain (the reason you see a different IP address), Traefik started routing the traffic properly to the app.
.com still has the SAME set of features ENABLED, yet the app is working just fine.
I have tried to troubleshoot cloudflare previously, but disabling its protection and other features yielded no results. That is why I was thinking Traefik is the root of this behavior.
This time it worked, so I am finally relieved of this headache.
Thanks to @cakiwi, I've learned that curl has a parameter --resolve, which helped me to look in the right direction.
I am not able to close the topic, so if you can do it, please go ahead and do so.