Nginx reverse proxy (proxy_pass) does not pass sub

2020-05-03 12:15发布

I want to run the application Mattermost in a subfolderconfiguration like

https://www.example.com/mattermost/

   location /mattermost/ {
           gzip off;
           proxy_set_header X-Forwarded-Ssl on;
           client_max_body_size 50M;
           proxy_set_header Upgrade $http_upgrade;
           proxy_set_header Connection "upgrade";
           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 $scheme;
           proxy_set_header X-Frame-Options   SAMEORIGIN;
           proxy_pass http://localhost:8065/;
   }

With this configuration I'll get passed to the correct application but the application does not recognize the subfolder. It tries to server

https://www.example.com/static/style.css instead of https://www.example.com/mattermost/style.css and brings up a 404 error.

How can I pass also the subfolder to the reverse proxy with nginx?

1条回答
三岁会撩人
2楼-- · 2020-05-03 12:18

The application I wanted to get running was "Mattermost". As I now can confirm, the use as subfolder is not possible with the Version

Mattermost Team Edition Version: 3.0.0 (3.0.3)

Further information:

http://forum.mattermost.org/t/blank-page-when-installing-mattermost-with-nginx-proxy-pass-as-subdirectory/1604/8

Update: As confirmed in the forum above, a subfolder configuration is not possible with Mattermost right now.

查看更多
登录 后发表回答