Mattermost Peer-to-Peer Forum

Error 405 only in nginx server when trying put of new role

#1

This is driving me nuts.
I have a mattermost instance behind nginx on /mattermost.
A lot works, but when chainging the role of a user to admin the client performs a put and nginx returns a 405. I have no clue where to check next. I think I looked everywhere.

Anybody a clue?
Kind regards,
Jeroen Baten

#2

Hi @kwoot,

Thanks for reaching out. Would you be open to reviewing this web page and sending us the relevant environment details and logs so we can diagnose this issue?

#3

What OS and version is the Mattermost server installed: CentOS Linux release 7.6.1810 (Core)
What is your Mattermost server version: 5.9.0
Are you experiencing the issues with the browser webapp, if so which one: Firefox and Chrome
Are you experiencing the issues with the Mattermost Desktop App, if so what version and OS: Unknown
Are you experiencing the issues with the Mattermost Mobile App, if so what version and OS: Unknown
Can you send a snippet of the Mattermost server logs around the time of the incident:

{“level”:“debug”,“ts”:1554196581.201783,“caller”:“scheduler/scheduler.go:40”,“msg”:“Scheduling Job”,“scheduler”:“PluginsScheduler”}
{“level”:“debug”,“ts”:1554196581.2205625,“caller”:“jobs/schedulers.go:167”,“msg”:“Next run time for scheduler PluginsScheduler: 2019-04-02 11:17:21.220542478 +0200 CEST m=+421.792463082”}
{“level”:“debug”,“ts”:1554196584.432202,“caller”:“scheduler/worker.go:49”,“msg”:“Worker received a new candidate job.”,“worker”:“Plugins”}
{“level”:“info”,“ts”:1554196584.4463892,“caller”:“scheduler/worker.go:78”,“msg”:“Worker: Job is complete”,“worker”:“Plugins”,“job_id”:“uff38xh3uig39nkbbkaht4d6jr”}
{“level”:“debug”,“ts”:1554196608.4991677,“caller”:“web/handlers.go:58”,“msg”:“GET - /mattermost/api/v4/users”}
{“level”:“debug”,“ts”:1554196608.4999979,“caller”:“web/handlers.go:58”,“msg”:“GET - /mattermost/api/v4/analytics/old”}
{“level”:“debug”,“ts”:1554196608.5013506,“caller”:“web/handlers.go:58”,“msg”:“GET - /mattermost/api/v4/teams”}
{“level”:“debug”,“ts”:1554196612.3551257,“caller”:“web/handlers.go:58”,“msg”:“GET - /mattermost/api/v4/users/f963u6rd9trg7jrcfmk563orwh/teams”}
{“level”:“debug”,“ts”:1554196612.355118,“caller”:“web/handlers.go:58”,“msg”:“GET - /mattermost/api/v4/users/f963u6rd9trg7jrcfmk563orwh/teams/members”}
{“level”:“debug”,“ts”:1554196612.4309273,“caller”:“web/handlers.go:58”,“msg”:“GET - /mattermost/api/v4/users/f963u6rd9trg7jrcfmk563orwh/tokens”}

Are you running Mattermost in a container and/or using container orchestration: No

Find out which database they are using. We only support PostgreSQL and MySQL currently: Postgres

WebSocket Issues
Can you send us the following Mattermost server configuration settings:
ServiceSettings.SiteURL:“SiteURL”: “https://dlt.purmerend.nl/mattermost”,
“WebsocketURL”: “wss://dlt.purmerend.nl/mattermost”,
ServiceSettings.ListenAddress: 8065
ServiceSettings.AllowCorsFrom: “dlt.purmerend.nl”
ServiceSettings.WebsocketSecurePort: 443
ServiceSettings.WebsocketPort: 80

Can you send us your Nginx configuration files: yes, But preferable by email.

Can you send us a snippet of your Nginx error logs around the time of the incident:

83.162.200.97 - - [02/Apr/2019:11:10:50 +0200] “PUT /mattermost/api/v4/users/xj1brin847njxnjqxz14wqjcko/preferences HTTP/2.0” 405 166 “-” “Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:66.0) Gecko/20100101 Firefox/66.0” “-”

#4

Hi @kwoot,

Would you be open to sharing your Nginx configuration? You can remove any parts you don’t feel comfortable to share.

#5

This should cover the Mattermost related part:

location ~ /mattermost/api/v[0-9]+/(users/)?websocket$ {
allow all;
add_header Allow “GET, POST, PUT, HEAD” always;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection “upgrade”;
client_max_body_size 50M;
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_buffers 256 16k;
proxy_buffer_size 16k;
client_body_timeout 60;
send_timeout 300;
lingering_timeout 5;
proxy_connect_timeout 90;
proxy_send_timeout 300;
proxy_read_timeout 90s;
proxy_pass http://127.0.0.1:8065;
}

    location /mattermost/ {
    allow all;
    add_header Allow "GET, POST, PUT, HEAD" always; 
            proxy_set_header X-Frame-Options SAMEORIGIN;
            proxy_pass http://127.0.0.1:8065;  

            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
    }
#6

Hi @kwoot, Would you be open to joining our Peer-to-Peer Help channel on our community server for more help on this issue?

I’m not sure what the solution is and I haven’t received feedback from our team in the past few days on this yet.