-
-
Save DeepInThought/1bea54e2cef118095c399c52e746536b to your computer and use it in GitHub Desktop.
Swagger UI PathPrefix patches for Traefik
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.3' | |
services: | |
apidocs: | |
image: swaggerapi/api-ui | |
environment: | |
API_URL: http://api.example.com/swagger.json | |
ports: | |
- 8080 | |
labels: | |
traefik.enable: true | |
traefik.port: 8080 | |
# match request paths without a trailing slash and redirect to the same | |
# path, including the trailing slash. This prevents extrenal asset | |
# inclusion issues for relative paths. | |
# https://github.com/containous/traefik/issues/563#issuecomment-421360934 | |
traefik.frontend.rule: "Host:example.com;PathPrefix:/api;ReplacePathRegex:^/api/(.*) /$$1" | |
traefik.frontend.redirect.regex: ^(.*)/api$$ | |
traefik.frontend.redirect.replacement: $$1/api/ | |
traefik.frontend.redirect.permanent: true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment