Nginx reverseproxy is not workibg with graylog for sub-directory

my graylog version is 3.0 and this is my nginx.cof

worker_processes 1;

events { worker_connections 1024; }

http {

sendfile on;

upstream docker-graylog {
    server graylog:9000;
server {
    listen 80;

    location /graylog/ {
       proxy_redirect     off;
        proxy_set_header   Host $host;
        proxy_set_header   X-Real-IP $remote_addr;
        proxy_set_header   X-Forwarded-Server $host;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Host $host/;
        proxy_set_header   X-Graylog-Server-URL  http://$http_host/graylog;
       proxy_pass  http://graylog:9000/;


Whn I try to access the graylog with /graylog path,It is appending the context twice for the options under the system.Please help me on this.

thanks in advance…

Sorry, Could you highlight the different between your problem and the min 10 closed and solved posts in this community with the same problem?

//If you read the graylog docs, I think you will find a problem. I see a mistake.

1 Like

sorry for not explaining my problem properly.As you suggested I read all the graylog docs but I didn’t find any solution to my problem.
I configured my graylog through nginx to access with the http://:/graylog/.
Bu using the above configuration I am able to get the web interface of graylog with /graylog context.
It is working fine for the options like search,streams,dashboards,alerts.sources it is working very well.BUt for the options under the system like inputs and outputs it is framing the url as http://:/graylog/graylog/system/xxxx.

my graylog and nginx is running in the docker containers

please find the attachments

first check X-Graylog-Server-URL property…

I just pasted the X-Graylog-Server-URL property above.if you find anything wrong,please let me know.

as I see, you missed the doc in this topic.

I would like to highlight this part

How does the web interface connect to the Graylog server?

The web interface is fetching all information it is showing from the REST API of the Graylog server. Therefore it needs to connect to it using HTTP(S). There are several ways how you can define which way the web interface connects to the Graylog server. The URI used by the web interface is determined in this exact order:

  • If the HTTP(S) client going to the web interface port sends a X-Graylog-Server-URL header, which contains a valid URL, then this is overriding everything else.
  • If http_external_uri is defined in the Graylog configuration file, this is used if the aforementioned header is not set.
  • If http_publish_uri is defined in the Graylog configuration file, this is used if the aforementioned http_external_uri is not set.
  • If none of the above are defined, http://$http_bind_address is used.

The web interface assets (e.g. the index.html , CSS and JavaScript files) are accessible at the URI root ( / by default) and the REST API endpoints are accessible at the /api path.

There is also an example config. It’s different from yours.

I’m experiencing the same thing. Installed 3.0 according to docs. All works fine when accessing it directly on my server via port 9000.
I want to access my GL instance through my Nginx proxy on another server.
So works perfect. All menu items resolve. API browser works.

After reading the docs I’ve setup my Nginx so I can access my GL like (Nginx hosted on srvB). Every item in the menu works, execpt when accessing something under System it wants to go to (mark the double gl!).

My nginx entry:

   # Slash graylog 
location /gl/ {
    proxy_set_header    Host                    $http_host;
    proxy_set_header    X-Forwarded-Host        $host;
    proxy_set_header    X-Forwarded-Server      $host;
    proxy_set_header    X-Forwarded-For         $proxy_add_x_forwarded_for;
    proxy_set_header    X-Graylog-Server-URL    https://$server_name/gl;
    rewrite             ^/gl/(.*)$  /$1  break;

I tried already various configs suggested on this board. What’s weird is that all works great exept those item menus under System. So when removing one ‘/gl’ ( it works!!

I think your not getting the problem what I am saying exactly,The above docs saying that will work with / context.For me its working as per the above docs.
In my case graylog wants to work with /graylog context,for this I changed the config and I clearly described the problem currently I am facing with /graylog context.

Don’t say again to check the documents,My requirement is graylog has to work with /graylog context not with / context.


Hi ,

Exactly I am also facing the same issue ,why it is appending the context again for the url for the options under the system.

have you been able to solve this issue?

I created an issue for that in github because I was able to verify the issue

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