Https by nginx: REST still uses http, XHR JS error

Hi. Had installed 3.1.4 version. Has been updated to 3.2, was hoped it’d help me but it didn’t.
Centos. Nginx.

Didn’t make any changes to the config file, except base one like generated pwd.
My task is: Reverse proxy with URL to graylog using nginx over HTTPS. Followed this:

So. My nginx.conf is absoultely the same as in an example.

location /folder/log/ {
                proxy_set_header   Host                  $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-Host      $host;
                proxy_set_header   X-Forwarded-Server    $host;
                proxy_set_header   X-Graylog-Server-URL  https://$server_name/folder/log/;

When I open my website, I have Server currently unavailable error.
And below I see that there was an attempt to make API request to HTTP (not HTTPS) to the graylog server. Although graylog webclient was loaded over HTTPS. (And there is force all redirects from HTTP to HTTPS, so it’s just true).

Opening the browser console I saw the following errors:

  1. Mixed Content: The page at 'https://<site>/folder/log/' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://<site>/folder/log/api/system/sessions'. This request has been blocked; the content must be served over HTTPS.

  2. There was an error fetching a resource: Request has been terminated Possible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.. Additional information: Not available

So, what I have to do?
Guess graylog installed and running properly cause I can use it directly by ip:port over SSH tunnel.

he @qioalice

what are your http_*settings in Graylog?

But more important - your nginx configuration is missing the rewrite part:

rewrite          ^/folder/log/(.*)$  /$1  break;

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