Reverse proxy behind looker instance for injecting custom styles

I need to have a reverse proxy for applying custom styles on embed looker dashboards. For that I prepared config

events {
  worker_connections  1024;  ## Default: 1024
}
http {
    server {
        listen 80;

        error_log /var/log/nginx/error.log debug;

        location / {
            # resolver 8.8.8.8;
            proxy_pass https://looker.domain.com:19999; # Replace looker.domain.com with the name
                                                    # that clients will use to access Looker

            ### Force timeouts if one of backend hosts is dead ###
            proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;

            ### Set headers ###
            proxy_set_header          X-Real-IP $remote_addr;
            proxy_set_header          Accept-Encoding "";
            # proxy_set_header          Host $http_host;
            proxy_set_header Referer "https://looker.domain.com:19999";
            proxy_set_header          X-Forwarded-For $proxy_add_x_forwarded_for;

            ### Don't timeout waiting for long queries - timeout is 1 hr ###
            proxy_read_timeout        3600;
            proxy_set_header          X-Forwarded-Proto $scheme;

            ### By default we don't want to redirect ###
            # proxy_redirect            off;

            proxy_buffer_size         128k;
            proxy_buffers             4 256k;
            proxy_busy_buffers_size   256k;
            proxy_intercept_errors on;
            error_page 301 302 307 = @handle_redirect;
        }

        location @handle_redirect {
            resolver 8.8.8.8;
            set $saved_redirect_location '$upstream_http_location';
            proxy_set_header Referer "https://looker.domain.com:19999";
            proxy_set_header  Host looker.domain.com:19999;
            proxy_pass $saved_redirect_location;
        }
    }
}

the main problem is that using this code Iframe loads app_state from API, but doesn’t request another API calls (models and etc) and I have a blank page.
Could you please share correct config or at least lemme know what’s wrong with my config

4 Likes

Hey Denis, I’m encountering the same problem. Were you by any chance able to figure out a solution? Thanks