Strip prefix works only on single hierarchy

Hi,
I have web server that stores our docs under the root path '/'

I configured route as below:
image

and middleware
image

But it looks like every request forwarded to the server still has /api prefix (without /docs)

Is it the expected behavior? any idea?

I would expect that Traefik handles the PathPrefix as pure string, so no „levels“ through Traefik.

You can run a service/container/image like traefik/whoami to see the request variables.

Share your full Traefik static/dynamic config and docker-compose.yml if used.

Config:

Compose:

Backend without traefik:
first request:

second request:

Backend with traefik:
first request:


second request:

  • of course this is the same backend instance, and only the first request made by me directly (root URL)

Thanks ! (:

I can solve the issue by hotfix with this configuration...
but I don't like it cause I don't know why is it happening

I am not sure what you are doing. Traefik container is listening on port 80, but you don’t declare an entrypoint on 80.

Your service is opening own port, but that’s not required as Traefik connects to an internal port, when Traefik and service are both on default bridge network (through compose) or custom Docker network.

The advantage of Traefik and Docker is automatic Config Discovery, check this simple example. But you use manuel router and service config.

Just food for thought…

I would expect the redoc path coming from your service, check browser developer tools network tab for responses with redirect.

It is just a test deployment to test it...

  • I removed port 80, it has nothing related to the issue.

  • The external port used to test the direct connection to redoc.

  • I don't want the dynamic discovery since I need to mount docker.soc and let traefik have more privileges.

  • No Redirect requests at all

if you have any suggestions on what should I check It will be great thanks.

Thanks anyway.

Seems to me redoc is using port 80 by default?

(Source)

I used ENV PORT 8080 and built my own image