Issue Summary

Hi,

First a big thanks to the whole community for this great piece of Open Source software. :+1:

So, I’m trying to run Redash in Docker listening to HTTPS only. But the setup below creates an infinite redirect loop when hitting the index page.

docker-compose.yml: (stripped)

services:
    redash_nginx_https:
        image: nginx:latest
        ports:
            - "443:443"
        links:
            - redash_server:redash
        volumes:
            - ./nginx.conf:/etc/nginx/conf.d/default.conf
            - # certificate files

    redash_server:
        image: redash/redash:8.0.2.b37747
        command: server
        environment:
            REDASH_LOG_LEVEL: DEBUG
            REDASH_ENFORCE_HTTPS: 1
            REDASH_HOST: my_domain_name
            REDASH_SECRET_KEY: (...)

nginx.conf: (stripped)

server {
    listen 443 ssl;
    server_name my_domain_name;

    # SSL configuration

    location / {
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;

        proxy_pass http://redash:5000;
    }
}

Issue reproduction:

$ curl -I https://my_domain_name/
HTTP/1.1 302 FOUND
Location: https://my_domain_name/  # -> infinite redirect loop

Redash server logs show no traffic, however I am quite sure it is responsible for the redirect loop because the request hangs if I stop the redash_server container.

Also, I tried:

  • Disabling REDASH_ENFORCE_HTTPS: hitting https://my_domain_name/ redirects 302 to http://my_domain/login?next=(…) . Expected, but not what I need.
  • Setting REDASH_HOST to https://my_domain_name (with the scheme). Same issue.

Technical details:

  • Redash Version: 8.0.2.b37747
  • How did you install Redash: self-hosted, Docker

OK, solved it :blush:

Redash needs the reverse-proxy to pass the original host in the X-Forwarded-Host header, not Host.

Working nginx configuration:

server {
    listen 443 default ssl;

    # SSL certificates

    location / {
        proxy_pass http://redash_server:5000;
        proxy_set_header X-Forwarded-Host $http_host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto https;
    }
}
1 Like

Thanks so much for sharing this. I was struggling to figure it out myself.

1 Like

Hi @rkz,
I am facing the same issue of TOO_MANY_REDIRECTS…

Can you help me with similar configuration for apache?
I am using apache for reverse proxy.