New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Traefik not routing path correctly #1037
Comments
Interested also as I had the same issue yesterday ; I only tried the
|
@nsteinmetz See my update. Apparently this #374 was part of the problem. |
@Mr-Right2 thanks for the update ; in fact, on my real sample, I removed the ending slash. I should have copied to be consistent with my case:
Will double check anyway ! |
@Mr-Right2's solution worked for me (removing the trailing |
Closed by #1638, in the version 1.3.0-rc3. |
What version of Traefik are you using (
traefik version
)?v1.1.2 / camembert
What is your environment & configuration (arguments, toml...)?
Ubuntu 16.04 with Docker version 1.12.5 and docker-compose version 1.9.0
No toml configuration used (see docker-compose yml below)
What did you do?
I started one whoamI and a few (five) Portainer containers. My goal is to have a container available at a certain path; whoamI should be available at
<myIP>/wai
and Portainer<myIP>/portainer
. I'm not exactly sure which frontend rule I need to achieve this (Path, PathPrefix, PathStrip or PathPrefixStrip) but I would assume it should be just the Path one. Below is my docker-compose file in which I tried all posibilities.docker-compose.yml:
Traefik startup logs:
What did you expect to see?
I would expect the whoamI webserver to be available at
<myIP>/wai
and Portainer to be available at `/portainer1.What did you see instead?
As can be seen in the in the attachment below, whoamI is reachable and works as it should. Portainer, however, cannot be reached at
<myIP>/portainer1
(I get a404 page not found
). Instead I am able to reach (parts of) it at<myIP>/portainer2
. As can be seen below, a white page is shown instead of the Portainer interface (shown bottom right for reference).It might be worth noting that navigating to
<myIP>/portainer4/
(but not<myIP>/portainer4
) shows the same white page as when navigating to<myIP>/portainer2
. There is, however, a noticable difference between these two: When the (white) Portainer page is loaded when navigating to<myIP>/portainer2
, only line is shown in the Traefik log (see below). When navigating to Portainer via<myIP>/portainer4
, three extra lines show up in the log indicating a 400 status. After some investigation, I found out that this comes from my browser's attempt to load additional files (i.e. a javascript file, a favicon and a stylesheet). So, when accessing Portainer at<myIP>/portainer4/
my browser apparently knows it needs to fetch those extra files and tries to do so (which does not happen when navigating to<myIP>/portainer2
). When trying to access the files myself by, for example, navigating to<myIP>/portainer4/ico/favicon.ico
, I get a400 Bad Request
. Lastly, when navigating to<myIP>/portainer2/ico/favicon.ico
is see a404 page not found
.So based on these results I'm wondering:
<myIP>/portainer1
but instead on<myIP>/portainer2
<myIP>/portainer2
<myIP>/portainer2/
and<myIP>/portainer4/
400 Bad Request
actually means and if/how this problem this problem can be fixedMaybe it would be nice if Traefik can generate some more detailed logging on how it routes traffic to containers since the logging (at debug level) is still a bit scarce.
Additional Traefik logging generated after visiting
<myIP>/wai
,<myIP>/portainer1/
,<myIP>/portainer2/
,<myIP>/portainer3/
and<myIP>/portainer4/
, respectively:My Traefik dashboard:
Solution
Finally found the solution. The correct approach in cases like these should be to use the PathPrefixStrip rule. However, as mentioned in #374, putting a
/
at the end of the rule will break the setup. I created a working configuration by removing/
at the end of thePathPrefixStrip: /portainer4/
rule. So this docker-compose configuration worked for me:Now when I navigate to
<myIP>/portainer/
I see the portainer page.Note: I still get the white page as mentioned earlier when I navigate to
<myIP>/portainer
.The text was updated successfully, but these errors were encountered: