Skip to content
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

426 Upgrade required error #32

Open
haath opened this issue Sep 10, 2021 · 4 comments
Open

426 Upgrade required error #32

haath opened this issue Sep 10, 2021 · 4 comments

Comments

@haath
Copy link

haath commented Sep 10, 2021

Hello, I am using an hxWebSockets server behind an apache proxy. I am trying to access it through normal js websockets on a browser, but it seems like the connection fails at the stage where the protocol should be upgraded to a websocket.

image

It seems like the request is reaching the backend server, because the following appears in the logs:

INFO  :: Starting server - 0.0.0.0:8000 (maxConnections: 100)
DEBUG :: ID-1 :: New socket handler
DEBUG :: ID-1 :: Adding to web server handler to list - total: 1
DEBUG :: ID-1 :: Bytes read: 641
DEBUG :: ID-1 :: Closed
DEBUG :: ID-1 :: Removing web server handler from list - total: 0

So the websocket server is closing the connection without returning the proper upgrade headers?

Is this something that can be fixed on the side of this library?
Or could you recommend some apache config where it should work?

@ianharrigan
Copy link
Owner

Im not sure what apache config might help... have you tried running it without a proxy? Is it fine then? Also, when haxe target is the server running on?

Cheers,
Ian

@haath
Copy link
Author

haath commented Sep 14, 2021

Hey thanks for the response! The target in this case is cpp, but I could try others if you think it makes a difference.

Without a proxy everything works with insecure ws://. My issue is browsers require secure websockets when the page is loaded over https:// so my go-to method is to use a proxy because I manage all of my certificates on apache.

I could also try using WebSocketSecureServer but then my server only has one 443 port and apache is using it. 😄
And some browsers also don't like non-standard ports for SSL connections.

@haath
Copy link
Author

haath commented Sep 23, 2021

Ok so I tried it with WebSocketSecureServer on a nonstandard port, with valid certificates. Now I try to connect to it directly without a proxy, and Firefox gives the following error:

main.js:1218 WebSocket connection to 'wss://xxxxxx:8000/' failed:

And on the server side I get the following.

INFO  :: Starting server - 0.0.0.0:8000 (maxConnections: 100)
DEBUG :: ID-1 :: New socket handler
DEBUG :: ID-1 :: Adding to web server handler to list - total: 1
DEBUG :: ID-1 :: Closed
DEBUG :: ID-1 :: Removing web server handler from list - total: 0
DEBUG :: ID-2 :: New socket handler
DEBUG :: ID-2 :: Adding to web server handler to list - total: 1
DEBUG :: ID-2 :: Closed
DEBUG :: ID-2 :: Removing web server handler from list - total: 0

@ianharrigan
Copy link
Owner

Hmm, so it looks like it closes the connection instantly... i wonder if the client (FF) is doing that? Does chrome behave differently? What about a non "non standard" port? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants