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?
Asked
Active
Viewed 167 times
1 Answers
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
-
no i want to rewrite it because of unraid wich is using wss in the frontend but the protocol is https in the backend – T0b1a5 May 08 '23 at 18:10
-
That sounds like a bug in Unraid, so you should probably ask them to fix that bug. – vidarlo May 08 '23 at 18:14
-
There musst be another way – T0b1a5 May 08 '23 at 18:23
-
If frontend and backend of a product doesn't agree on what protool to use, it's a bug. – vidarlo May 08 '23 at 19:05
-
Could be but i’m not search for the cause im searching for a solution to fix the problem without changing the code of the server – T0b1a5 May 08 '23 at 19:10