0

Hi im currently trying to find a way to switch out the protocol of a url. Im having a server wich is running fine on its own but behind a apache reverse proxy its throwing the error connection to websocket failed. The problem is that the Websocket is only locally available as wss:// through the ip of the server it gets switched to https://. Is there any way to switch it back ok a apache reverse proxy?

T0b1a5
  • 1
  • 3

1 Answers1

2

You don't want to switch protocols. WSS and https are two different protocols - for a reason. If your app requires wss it requires wss.

What you want is to configure Apache to proxy https and wss for you. That can be done with mod_rewrite. Add something along the lines of the following to your vhost stanza:

ProxyRequests Off    
RewriteEngine On
RewriteCond %{HTTP:Connection} Upgrade [NC]
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteRule /(.*) wss://localhost:8123/$1  [P,L]
vidarlo
  • 6,654
  • 2
  • 18
  • 31