Traefik redirecting from https to https

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 direct access 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)?

The problem isn't in traefik.
Apache superset use flask and X-Fowarded headers needed to be set in flask.

Here some explanation.

In the specific case of superset, just set ENABLE_PROXY_FIX=True in config.py solve the issue.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.