-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
404 on client handshake #1343
Comments
Node.js v7.x is no longer supported, does the same happen with a supported release line (v4.x, v6.x, v8.x, v9.x)? It can be this commit 9e152f9 but no breaking changes were expected. |
Just tried on v9.10.1, still having the same issue on 5.1.0 but not on 5.0.0. |
Are you able to create a reproducible test case so that we can take a look? |
@summerwollin can you try with 5.1.1? |
Yes same issue on 5.1.1. I can try to give you a test case, but I have to modify what I have since it is code my company owns. I am using ws as a proxy between our clients (browser sessions) and our server. Given the following chunk of code that 404 is logged by
The 404 appears to occur during the initial handshake and results in the wsClient closing with code 1006 (abnormal closure). I end up looping in |
Can you try running the following code to connect to your backend server? This is basically what ws does under the hood: const crypto = require('crypto');
const https = require('https');
const tls = require('tls');
const request = https.get({
headers: {
'Sec-WebSocket-Key': crypto.randomBytes(16).toString('base64'),
'Sec-WebSocket-Version': 13,
'Connection': 'Upgrade',
'Upgrade': 'websocket'
},
createConnection: tls.connect,
hostname: 'replace',
path: '/replace',
port: 'replace'
});
request.on('upgrade', function () {
console.log('It works.');
}); Does your backend server uses SNI or some special configuration? |
Running the above returns an error: |
Actually turns out we do support TLS 1.0 and 1.1. Sorry for the confusion, my IT guy just checked and updated me. |
The above snippet only uses core modules, no npm packages. |
@summerwollin sorry to pester, any update? I guess the server is not publicly accessible. Can you somehow allow me to debug this issue? |
Yes sorry - it's been a busy week here at work. Running the above exactly as written using the core modules returns:
On 5.0.0, 5.1.0, and 5.1.1. Hostname, path, and port are all identical to what I'm connecting to in my proxy on 5.0.0. |
Ok we are getting closer, does it work if you remove the |
No, same error |
I don't know then, if the above snippet does not work I can't see how |
Closing this as it's hard to fix without a reproducible test case. I know you have one but unfortunately it can't be shared. |
Fair, whenever I have time I'll try to figure out the issue. Thanks for looking. |
Similar to #1208
Description
I am getting this 404 response on the initial handshake and it is causing the error handler to trigger and close the socket.
I only have this issue on version 5.1.0 of ws. Downgrading back to 5.0.0 solved the issue and I no longer receive a 404. Were there breaking changes in the 5.1.0 release?
Reproducible in:
version: 5.1.0
Node.js version(s): 7.7.2
OS version(s): OSX 10.12.4
The text was updated successfully, but these errors were encountered: