Nginx reverse proxy (proxy_pass) does not pass subfolder

喜夏-厌秋 提交于 2019-12-02 19:32:52

问题


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:


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.



来源:https://stackoverflow.com/questions/37650640/nginx-reverse-proxy-proxy-pass-does-not-pass-subfolder

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!