This repository was archived by the owner on Nov 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 367
This repository was archived by the owner on Nov 21, 2024. It is now read-only.
failed: Error during WebSocket handshake: Unexpected response code: 404 #513
Copy link
Copy link
Open
Description
Hi,
I have prosody server with nginx set up on my localhost, which run fine together with other xmpp web clients like converse.js. But I'm banging my head to make Candy chat working, as I get this error, whatever configs that choose:
WebSocket connection to 'ws://127.0.0.1:5280/http-bind' failed: Error during WebSocket handshake: Unexpected response code: 404
Here is my config index.html:
$(document).ready(function() {
Candy.init('ws://127.0.0.1:5280/http-bind', {
core: {
debug: true,
autojoin: true
},
view: { assets: '../res/' }
});
Candy.Core.connect('localhost');
});
And /etc/nginx/sites-available/default :
server {
listen 80 default_server;
location / {
root /home/me/candy;
index index.html;
location /http-bind/ {
proxy_pass https://127.0.0.1:5280/http-bind/;
proxy_buffering off;
tcp_nodelay on;
}
error_page 405 =200 $uri;
}
}
And /etc/prosody/prosody.cfg.lua:
modules_enabled = {
"roster";
"saslauth";
"tls";
"dialback";
"disco";
"version";
"uptime";
"time";
"ping",
"register";
"posix";
"bosh";
};
allow_registration = true;
daemonize = true;
consider_bosh_secure = true;
cross_domain_bosh = true;
pidfile = "/var/run/prosody/prosody.pid";
c2s_require_encryption = false;
authentication = "internal_plain"
log = {
debug = "/var/log/prosody/prosody.log";
error = "/var/log/prosody/prosody.err";
{ levels = { "error" }; to = "syslog";
};
}
VirtualHost "localhost"
enabled = true
ssl = {
key = "/etc/prosody/certs/example.com.key";
certificate = "/etc/prosody/certs/example.com.crt";
}
VirtualHost "anonymous.localhost"
authentication = "anonymous"
Component "component.localhost"
component_secret = "supersecretpw"
Component "chat.localhost" "muc"
Browser console error log:
[Init] Debugging enabled
candy.bundle.js:202 [Connection] Connecting
libs.min.js:2 WebSocket connection to 'ws://127.0.0.1:5280/http-bind' failed: Error during WebSocket handshake: Unexpected response code: 404
_connect @ libs.min.js:2
connect @ libs.min.js:1
a.connect @ libs.min.js:2
a.connect @ candy.bundle.js:320
(anonymous) @ candy.bundle.js:4197
dispatch @ jquery.min.js:5
v.handle @ jquery.min.js:5
candy.bundle.js:234 [Strophe][ERROR]: Websocket error [object Event]
k.debug.b.log @ candy.bundle.js:234
error @ libs.min.js:1
_onError @ libs.min.js:2
candy.bundle.js:202 [Connection] Failed (2)
candy.bundle.js:234 [Strophe][INFO]: _doDisconnect was called
candy.bundle.js:234 [Strophe][INFO]: WebSockets _doDisconnect was called
candy.bundle.js:202 [Connection] Disconnected
candy.bundle.js:234 [Strophe][ERROR]: User connection callback caused an exception: TypeError: Cannot read property 'indexOf' of null
k.debug.b.log @ candy.bundle.js:234
error @ libs.min.js:1
_changeConnectStatus @ libs.min.js:1
_doDisconnect @ libs.min.js:1
_disconnect @ libs.min.js:2
_onError @ libs.min.js:2
candy.bundle.js:234 [Strophe][INFO]: Websocket closed
This problems bugs me for sooo long. So appreciate your hints to resolve it.
Thanks
Metadata
Metadata
Assignees
Labels
No labels