-
Notifications
You must be signed in to change notification settings - Fork 362
Closed
Description
When Strophe accesses ejabberd through websocket directly ws://chat.test:5280/ws I'm able to connect to the server
However, while using http://chat.test/ws I'm getting 400 Bad Request
When connected to the through websocket directly ws://chat.test:5280/ws using Strophe - This is what I see in the log file
2018-12-24 01:10:31.618 [debug] <0.16549.0>@ejabberd_http:init:147 S: [{[<<"ws">>],ejabberd_http_ws},{[<<"bosh">>],mod_bosh},{[<<"api">>],mod_http_api},{[<<"admin">>],ejabberd_web_admin},{[<<"http-bind">>],mod_bosh}]
2018-12-24 01:10:31.618 [debug] <0.16549.0>@ejabberd_http:process_header:305 (#Port<0.19959>) http query: 'GET' <<"/ws">>
2018-12-24 01:10:31.619 [debug] <0.16549.0>@ejabberd_http:process:392 [<<"ws">>] matches [<<"ws">>]
2018-12-24 01:10:31.619 [debug] <0.16550.0>@ejabberd_http_ws:init:146 Client connected through websocket {http_ws,<0.16550.0>,{{0,0,0,0,0,65535,2790,43534},54222}}
I see the request coming in as a GET request
However while using nginx proxy http://chat.test/ws
2018-12-24 01:11:05.622 [debug] <0.16554.0>@ejabberd_http:init:147 S: [{[<<"ws">>],ejabberd_http_ws},{[<<"bosh">>],mod_bosh},{[<<"api">>],mod_http_api},{[<<"admin">>],ejabberd_web_admin},{[<<"http-bind">>],mod_bosh}]
2018-12-24 01:11:05.622 [debug] <0.16554.0>@ejabberd_http:process_header:305 (#Port<0.19961>) http query: 'POST' <<"/ws">>
2018-12-24 01:11:05.623 [debug] <0.16554.0>@ejabberd_http:process:392 [<<"ws">>] matches [<<"ws">>]
I see the request coming in as a POST request
Here's my Nginx Config
location /ws {
proxy_pass http://127.0.0.1:5280/ws;
proxy_http_version 1.1;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
Upon reading through the code, I see that only when the protocol is ws or wss it is handled as websocket and if it is http or https it is handled as BOSH.
Appreciate any help please.
Thanks!
Metadata
Metadata
Assignees
Labels
No labels