Path under subdirectory returns 404

I'm having an issue with subdirectories. I've removed all middlewares to show the issue I'm having.

Note: Because I have removed the stripprefix I full expect for the service (backend) to respond with a 404 since it is listening for "/".


  phpmyadmin:

    image: phpmyadmin/phpmyadmin

    networks:

      - sql

      - traefik_public

    restart: on-failure

    environment:

      - PMA_ABSOLUTE_URI=https://test.example.com/phpmyadmin

    labels:

      - "traefik.enable=true"

      - "traefik.http.routers.phpmyadmin.rule=Host(`test.example.com`) && Path(`/phpmyadmin`)"

      - "traefik.http.routers.phpmyadmin.entrypoints=websecure"

      - "traefik.http.routers.phpmyadmin.tls=true"

If I request a page that matches the router rule exactly things work as expected:


mtucker502@myserver:$ curl -k https://test.example.com/phpmyadmin

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">

<html><head>

<title>404 Not Found</title>

</head><body>

<h1>Not Found</h1>

<p>The requested URL was not found on this server.</p>

<hr>

<address>Apache/2.4.38 (Debian) Server at test.example.com Port 80</address>

</body></html>

I also see that my service is receiving and responding to this request:


mtucker502@myserver:$ docker logs mariadb_phpmyadmin_1 --since 1m

172.21.0.3 - - [11/Feb/2020:14:57:52 +0000] "GET /phpmyadmin HTTP/1.1" 404 437 "-" "curl/7.58.0"

However if I request any page deeper in the router traefik sends a 404 and never forwards the request to my service:


mtucker502@myserver:$ curl -k https://test.example.com/phpmyadmin/test

404 page not found

mtucker502@myserver:$ docker logs mariadb_phpmyadmin_1 --since 1m

Here are the relevant traefik logs:


10.76.69.113 - - [11/Feb/2020:14:57:52 +0000] "GET /phpmyadmin HTTP/2.0" 404 276 "-" "-" 1056 "phpmyadmin@docker" "http://172.21.0.4:80" 1ms

time="2020-02-11T14:58:06Z" level=debug msg="Serving default certificate for request: \"test.example.com\""

10.76.69.113 - - [11/Feb/2020:14:58:06 +0000] "GET /phpmyadmin/test HTTP/2.0" 404 19 "-" "-" 1057 - - 0ms

Is this a misconfiguration on my end? How can I have the rule match phpmyadmin and all requests under phpmyadmin?

1 Like

I have now learned the difference between Path and PathPrefix :).

Hi @mtucker502,

Trying to get phpmyadmin on a subfolder path as well.
Would you be able to explain Path/PathPrefix difference and how you pulled it off?