Skip to content

Instantly share code, notes, and snippets.

@DeepInThought
Forked from syntaqx/docker-compose.yml
Created May 30, 2019 09:46
Show Gist options
  • Save DeepInThought/1bea54e2cef118095c399c52e746536b to your computer and use it in GitHub Desktop.
Save DeepInThought/1bea54e2cef118095c399c52e746536b to your computer and use it in GitHub Desktop.
Swagger UI PathPrefix patches for Traefik
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