Traefik how to properly add trailing slash

Viewed 1638

I'm running a docker container (for vscode cloud) with traefik v1.7.21. Currently I can access my vscode with the following only with the trailing slash: http://example/test/. I want to be able to automatically redirect with just http://example/test

The only differences in the command I run:

Method 1 (works, but have to manually add trailing slash when entering url):

--label traefik.frontend.rule="PathPrefixStrip:/test"

Method 2 is what I want because it redirects to correct url (don't need to type trailing '/'), but gets stuck at dark grey screen of the vscode cloud server:

--label traefik.frontend.redirect.regex="^(.*)/test$" 
--label traefik.frontend.redirect.replacement="$1/test/" 
--label traefik.frontend.rule=PathPrefix:"/test;ReplacePathRegex: ^/test/(.*) /$1" 

I've tried using double "$" but it gives me an error. How can I access my site properly without having to type in the trailing slash?

For reference, here is the full command I run with method 1:

docker run -p <port:port> --network gateway --label traefik.backend=test --label traefik.port=<port> 
--label traefik.frontend.rule="PathPrefixStrip:/test"
--label traefik.frontend.entryPoints=http --label traefik.backend.buffering.maxResponseBodyBytes=0 --label traefik.backend.buffering.memRequestBodyBytes=0 
<docker image> --no-auth --allow-http -p <port>
0 Answers
Related