Hello Cummunities
I have a problem with traefik configuration with docker-compose. I need to redirect user when he enter with one domain to another.
f.eg. user is entering to domain.pl and he will be redirected to pl.domain.com.
The actual configuration looks like this
fe:
image: node:12-alpine
command: sh -c "npm install && npm run build && npm run start"
volumes:
- /srv/http:/app
working_dir: /app/appliation/
labels:
- "traefik.enable=true"
- "traefik.http.routers.shape-fe.entrypoints=http"
- "traefik.http.routers.shape-fe.rule=Host(`pl.domain.com`) || Host(`domain.pl`) || Host(`domain.com`) || Host(`domain.eu`) || Host(`www.domain.pl`) || >
- "traefik.http.middlewares.shape-fe-https-redirect.redirectscheme.scheme=https"
- "traefik.http.routers.shape-fe.middlewares=shape-fe-https-redirect"
- "traefik.http.routers.shape-fe-secure.entrypoints=https"
# - "traefik.http.middlewares.shape-fe.replacepathregex.regex: ^https?://domain.pl/(.*)"
# - "traefik.http.middlewares.shape-fe.replacepathregex.replacement: https://pl.domain.com$${1}"
- "traefik.http.middlewares.shape-fe-secure.headers.customFrameOptionsValue=SAMEORIGIN"
- "traefik.http.middlewares.shape-fe-secure.headers.framedeny=true"
- "traefik.http.middlewares.shape-fe-secure.headers.sslredirect=true"
- "traefik.http.middlewares.shape-fe-secure.headers.stsIncludeSubdomains=true"
- "traefik.http.middlewares.shape-fe-secure.headers.stsPreload=true"
- "traefik.http.middlewares.shape-fe-secure.headers.stsSeconds=15552000"
- "traefik.http.middlewares.shape-fe-secure.compress=true"
# - "traefik.http.routers.shape-fe-secure.middlewares=shape-fe-secure"
- "traefik.http.routers.shape-fe-secure.rule=Host(`pl.domain.com`) || Host(`domain.pl`) || Host(`domain.eu`) || Host(`domain.com`) || Host(`www.domain.pl>
- "traefik.http.routers.shape-fe-secure.tls=true"
- "traefik.http.routers.shape-fe-secure.tls.certresolver=le"
- "traefik.http.routers.shape-fe-secure.service=shape-fe"
- "traefik.http.services.shape-fe.loadbalancer.server.port=3000"
- "traefik.docker.network=_base_default"
Commented part is what I add but doesn't work. Moreover, this configuration was created some time ago by previous devops and I can't much experiment with that.
Any advice how can I achieve that?
Thanks