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

Cloudflare blocking Websockets - "Failed to upgrade connection" #31

Closed
carstenhag opened this issue Aug 19, 2015 · 8 comments
Closed

Cloudflare blocking Websockets - "Failed to upgrade connection" #31

carstenhag opened this issue Aug 19, 2015 · 8 comments

Comments

@carstenhag
Copy link

2015/08/19 20:56:32 New client connected: <my ip>:26736
2015/08/19 20:56:32 Failed to upgrade connection

Getting this error sometimes, only on Chrome. Firefox runs it well.
Client shows only a blank page.
Yesterday I had tried it out already and everything was fine.

@haliphax
Copy link

Do you have a proxy sitting in front of GoTTY, or is it raw? Just curious, since I was having this issue, as well, but fixed it with some nginx configuration settings. Of course, I was constantly experiencing the error -- it wasn't intermittent.

@yudai
Copy link
Owner

yudai commented Aug 20, 2015

Is that possible to provide the command you ran?
If you are using a proxy as @haliphax mentioned, let me know that too.

@carstenhag
Copy link
Author

I ran both gotty htop -p "8080" and the one to start gotty with tmux from
the readme.

Nginx is running on the machine but gotty is not getting proxied by it.

Is that possible to provide the command you ran?
If you are using a proxy as @haliphax https://github.com/haliphax
mentioned, let me know that too.

@yudai
Copy link
Owner

yudai commented Aug 20, 2015

Thanks. Unfortunately, I have no idea about what's the cause but it's a websocket related issue.

@carstenhag
Copy link
Author

@yudai Ooh, I think I got the cause of this now. It's probably caused by Cloudflare. I have it only running on @ and only there it doesn't work. Tested on both Chrome and Firefox.

0

http://92.222.74.40:8080/ OK
http://znc.moter8.xyz:8080/ OK
http://moter8.xyz:8080/ KO

@carstenhag
Copy link
Author

https://support.cloudflare.com/hc/en-us/articles/200169466-Can-I-use-CloudFlare-with-websockets-

WebSockets are currently only available for Enterprise customers, but will be available for other plan levels in the future.

All other customers -- Business, Pro, and Free -- should create a subdomain for Websockets in their CloudFlare DNS and disable the CloudFlare proxy ("grey cloud" the record in CloudFlare DNS Settings).

@carstenhag carstenhag changed the title "Failed to upgrade connection" sometimes on Chrome Cloudflare blocking Websockets - "Failed to upgrade connection" Aug 20, 2015
@k0l0r3k99
Copy link

k0l0r3k99 commented Mar 24, 2018

I tcpdumped traffic before CloudFlare and after CloudFlare. CF removes only "Upgrade: websocket", other data are unchanged. Could gotty ignore "Upgrade: websocket"? Another way to fix is use nginx proxy and add header with upgrade.

Edit: use nginx doesn't resolve this. I've error: "Failed to authenticate websocket connection: websocket: close 1006 unexpected EOF". In JS, new WebSocket("wss://cloudflare/gotty/ws").onOpen is not called.

@rajeget
Copy link

rajeget commented Mar 25, 2018

For NGINX please see my page https://github.com/rajeget/websocket-nginx/ , it works

Let me know if that works for cloudfare as well .

benoittgt pushed a commit to honestica/gotty that referenced this issue Jun 14, 2022
Avoid HTTP 401 error on manifest.json due to CORS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants