Skip to content

Instantly share code, notes, and snippets.

@valorad
Created May 14, 2021 03:49
Show Gist options
  • Save valorad/7590048475555051a058a3e08199d83a to your computer and use it in GitHub Desktop.
Save valorad/7590048475555051a058a3e08199d83a to your computer and use it in GitHub Desktop.
traefik docker redirect statics example
---
version: "3.9"
services:
node:
labels:
- "traefik.enable=true"
# Vue Dev Server
- "traefik.http.routers.runvuedev.rule=Host(`runvuedev.code.hub`)"
- "traefik.http.routers.runvuedev.entrypoints=websecure"
- "traefik.http.routers.runvuedev.tls=true"
- "traefik.http.routers.runvuedev.service=runvuedev"
- "traefik.http.services.runvuedev.loadbalancer.server.port=8080"
# Backend Koa Server - Statics
- "traefik.http.routers.runnode.rule=Host(`runnode.code.hub`)"
- "traefik.http.routers.runnode.entrypoints=websecure"
- "traefik.http.routers.runnode.tls=true"
- "traefik.http.routers.runnode.middlewares=feRedirect"
- "traefik.http.routers.runnode.service=runnode"
- "traefik.http.services.runnode.loadbalancer.server.port=3000"
# front-end Redirect static
- "traefik.http.middlewares.feRedirect.redirectregex.regex=https://(.+?/)(.*)"
- "traefik.http.middlewares.feRedirect.redirectregex.replacement=https://statics.drive.hub/fe-bucket/$$2"
# Backend Koa Server
- "traefik.http.routers.runnodeAPI.rule=(Host(`runnode.code.hub`) && PathPrefix(`/api`))"
- "traefik.http.routers.runnodeAPI.tls=true"
- "traefik.http.routers.runnodeAPI.entrypoints=websecure"
- "traefik.http.routers.runnodeAPI.service=runnodeAPI"
- "traefik.http.services.runnodeAPI.loadbalancer.server.port=3000"
image: node:current-buster
restart: "no"
user: "1000"
stdin_open: true
tty: true
volumes:
- /workspace/workbench:/workspace/workbench
networks:
- main
networks:
main:
external:
name: main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment