Reputation: 3256
My service superset is configured to redirect HTTP to HTTPS
superset:
image: superset:base
container_name: superset_app
ports:
- '8080'
labels:
- "traefik.enable=true"
- "traefik.http.middlewares.http-to-https.redirectscheme.scheme=https"
- "traefik.http.routers.superset-http.middlewares=http-to-https"
- traefik.http.routers.superset-http.rule=Host("superset-lab.domain.com")
- "traefik.http.routers.superset-http.entrypoints=web"
- traefik.http.routers.superset.rule=Host("superset-lab.domain.com")
- "traefik.http.routers.superset.entrypoints=web-secure"
- "traefik.http.routers.superset.tls=true"
- "traefik.http.services.superset.loadbalancer.server.port=8080"
This config works as expected.
curl -Ik http://superset-lab.domain.com/login/?username=9999999&redirect=/superset/dashboard/
[1] 85007
HTTP/1.1 307 Temporary Redirect
Location: https://superset-lab.domain.com/login/?username=999999
Content-Length: 18
Content-Type: text/plain; charset=utf-8
But when I try to access direct by HTTPS, the request is redirected to http.
curl -Ik https://superset-lab.domain.com/login/?username=999999&redirect=/superset/dashboard/
[1] 85096
HTTP/1.1 302 Found
Content-Length: 209
Content-Type: text/html; charset=utf-8
Date: Mon, 26 Apr 2021 16:09:11 GMT
Location: http://superset-lab.domain.com/
Server: Werkzeug/1.0.1 Python/3.6.9
HttpOnly; Path=/; SameSite=Lax
Vary: Cookie
Is there a problem with my traefik labels or is something in the application (superset)?
Upvotes: 1
Views: 2872
Reputation: 3256
The problem isn't in traefik. Apache superset use flask and X-Fowarded headers needed to be set in flask.
Here some explanation. https://stackoverflow.com/a/23504684/4175515
In the specific case of Apache superset, just set up ENABLE PROXY_FIX=True in config.py to solve the problem.
Upvotes: 2