26 votes
Accepted

Proxy Websockets and HTTP through the same location in Nginx

The easiest way I found was to jump to different locations based on the "Upgrade" header: server { # ... location / { try_files /nonexistent @$http_upgrade; } location @websocket { #...
mkg20001's user avatar
  • 378
13 votes
Accepted

Apache mod_proxy: forward secure websocket to non-secure

To get things to work, I also needed to load mod_proxy_wstunnel Once I did, this ruleset got things working: (in the VirtualHost of the domain that receives and proxies the websocket request) <...
BeetleJuice's user avatar
7 votes
Accepted

Apache 2.4.7 mod_proxy_wstunnel tunneling too much (HTTP as well as WS)

anders' answer got me 95% of the way there. The basic scenario: We have a server on newapp.example.com Port 8080 is running both HTTP and WebSockets The URL that responds to WebSockets requests is /...
Brian Beckett's user avatar
7 votes
Accepted

nginx setup for wss:// keep getting 301 redirects

Your location directive refers to /chat/, but the endpoint you are trying to use is /chat. Because a location exists with the same path, with a / appended, nginx generates an internal redirect. If /...
Michael Hampton's user avatar
5 votes

Web app can't connect to websocket server

This was pretty easy to fix and is even written in the docs of the websocket server that I am using. Just needed to instantiate the WS server as follows ws = WebsocketServer(host='0.0.0.0', port=...
Max Mikhaylov's user avatar
5 votes
Accepted

Increase client timeout for WebSocket connections to certain URL

If some long-lived sessions are mixed with short-lived sessions (eg: WebSocket and HTTP), it's worth considering timeout tunnel, which overrides timeout client and timeout server for tunnels, as ...
Michael - sqlbot's user avatar
5 votes

No protocol handler was valid for the URL / (scheme 'ws')

I was getting that error as well. It happened when I proxying HTTPS requests to WS protocol. The error went away when I split the proxy to forward HTTPS requests to HTTP and WSS requests to WS. To ...
Stephen Ostermiller's user avatar
5 votes
Accepted

Why AWS classic ELB with HTTP protocol doesn't work with websockets?

The Classic ELB doesn't support Websockets. Why it doesn't is not something AWS publishes. From the chart in the reference below it specifically calls out, as you pointed out, that the ALB and NLB ...
kenlukas's user avatar
  • 3,196
5 votes
Accepted

NGINX double proxy not allowing websocket connections

Of course you should not drop the WebSocket proxying support from any of your intermediate proxy servers. WebSocket proxying is a very special task, to allow protocol switching and keep WebSocket ...
Ivan Shatsky's user avatar
  • 2,846
4 votes
Accepted

ProxyPass a WebSocket connection to a UNIX socket

Ok I got it, once you have mod_proxy and mod_proxy_wstunnel enabled you can do this: ProxyPass /ws/ unix:/path/to/app.sock|ws://example.com/ws/ It works well for me since I only expect to establish ...
zzantares's user avatar
  • 156
4 votes

Configuring Apache2 to proxy WebSocket?

This add's to @Andrew Moss' answer as to how to correctly configure the VirtualHost to work with socket.io 1.0! Feel free to skip the part about CentOS! If you're stuck on CentOS 6, here is how to do ...
Lukas Knuth's user avatar
4 votes

Apache2 WSS-rewrite

I recently had almost exactly the same problem. It worked with HTTP and WS, but when I switched to HTTPS and WSS it stopped working. I fiddled around a bit, and somehow made it work. This is my ...
Suppen's user avatar
  • 163
3 votes

Apache Cluster + Tomcat websocket

As discussed on the tomcat-users mailing list: "[...] the AJP protocol does not support upgrading to other protocols (e.g. websocket, HTTP/2)." This means you'd have to use some other method of ...
vdstw's user avatar
  • 86
3 votes
Accepted

IP Tables intercept exception

I'd do the following: -A PREROUTING -s 10.10.1.0/24 ! -d 10.10.1.1/32 --jump intercept-nat -A PREROUTING -s 10.1.2.0/24 ! -d 10.10.1.1/32 --jump intercept-nat -A intercept-nat -d target-ip -p tcp -m ...
Mauricio López's user avatar
3 votes

How to troubleshoot Nginx 499 when it's not returning a web sockets handshake back to the client?

Fixed. Had to replace the Classic AWS ELB with an ALB.
theMarceloR's user avatar
3 votes

NGINX Proxy Setup for ws:// protocol

No nginx documentation available mentions the ws:// scheme as available to use in the config. No wonder the nginx fails to start, I bet it's the configuration error it's complaining about. And you ...
drookie's user avatar
  • 8,759
3 votes

ws protocol and apache mod_proxy_wstunnel configuration: error 500

Looks like you are missing mod_proxy_wstunnel module which is required for Websockets support. It should be enabled like below in your httpd.conf LoadModule proxy_wstunnel_module modules/...
serverliving.com's user avatar
3 votes
Accepted

wss not working in https but ws works in http apache2 ubuntu

Well I fixed it myself. I changed my javascript into: var ws = new WebSocket('wss://domain.com/ws/'); Enabled proxy modules by running the following command in terminal, sudo a2enmod proxy ...
krkart's user avatar
  • 255
3 votes
Accepted

Nginx websoket reverse proxy caching

There's no such thing as websocket caching. Websocket is simply a messaging protocol. It transmits arbitrary messages back and forth.
Michael Hampton's user avatar
3 votes

NGINX Proxy pass to WebSocket and PHP not working with SSL

It seems like an issue with trailing slash at the and of location which contains proxy_pass directive. You can try adding it to your websocket location: location /websocket/ { proxy_pass http://...
Shanjohn's user avatar
2 votes
Accepted

Does Apache process handling Websocket proxy also serve same client for http?

It all depends on how your web application is designed. You can indeed pass "traditional http requests" through an established websocket... or you can process the request in the more traditional ...
TheCompWiz's user avatar
  • 7,479
2 votes

Apache 2.4.7 mod_proxy_wstunnel tunneling too much (HTTP as well as WS)

I'm using apache 2.4 as a proxy in front of my spring boot app, this app serves some rest api calls, websockets (sockjs) and some static pages. I had some problems getting the websocket to work, the ...
anders's user avatar
  • 121
2 votes
Accepted

Add proxy headers in named location using nested location regex

According to Richard from his comment on the original post, the original solution I came up with is not that bad. However, since I like to avoid repeating myself, I've opted to include a file which ...
Habovh's user avatar
  • 271
2 votes

High CPU load in a data aquisition server

I manage to figure out how to fix it using this link http://bencane.com/2012/08/06/troubleshooting-high-io-wait-in-linux/ Basically I ran iotop and that outputed which process was causing high IO ...
Alex's user avatar
  • 121
2 votes

Enabling WebSockets (SignalR) with a Barracuda WAF

So I have found out my problem. I have found out that we are actually sending our traffic to our WAF through an Azure Load Balancer first. When I log out the Headers in the WAF Access Logs I can see ...
jonhoare's user avatar
  • 201
2 votes
Accepted

Websocket working within LAN but 502 error from remote client with nginx proxy

Looking at the servers' responses, it seems you probably have an extra reverse proxy somewhere. It's on Apache/2.2.15 (CentOS) and you need to reconfigure it too, not only the nginx/1.12.1 (Ubuntu).
kubanczyk's user avatar
  • 14k
2 votes
Accepted

Kubernetes Ingress: How can I expose two ports on one path?

I think your second Backend service is missing the path, if you want to use ingress with one host and two services you should add the path. See ingress fanout then your ingress should be like: # ...
Alioua's user avatar
  • 421
2 votes

An Issue with an AWS EC2 instance when connecting it to WebSocket

Check that EC2 Security Group associated with the Instance permits access to all your ports, 8282, 8383, etc. Also what's the IP or hostname your JS code tries to connect to? Is it the EC2 instance ...
MLu's user avatar
  • 25.3k
2 votes

How to accept HTTPS and Websockets on a new Google Kubernetes Engine deployment?

not sure if this is still relevant, but yes - it can be done. # this will only provision if you the A record test.example.com will point to the address of the https load balancer # create a managed ...
Gilad Sharaby's user avatar
2 votes

Nginx timeout for websocket

I think you should also check system tcp timeout's, For linux based. /proc/sys/net/ipv4/tcp_keepalive_time /proc/sys/net/ipv4/tcp_keepalive_intvl /proc/sys/net/ipv4/tcp_keepalive_probes /proc/sys/...
asktyagi's user avatar
  • 2,926

Only top scored, non community-wiki answers of a minimum length are eligible