Replies: 7 comments 35 replies
-
Looking at the official documentation, the rewrite rule needs to be changed a bit. https://httpd.apache.org/docs/2.4/mod/mod_proxy_wstunnel.html ProxyPass / http://localhost:8888/
RewriteEngine on
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteCond %{HTTP:Connection} upgrade [NC]
RewriteRule ^/?(.*) "ws://localhost:8888/$1" [P,L] There are other reverse proxies which handle this then selfs, or need some other small adjustments. |
Beta Was this translation helpful? Give feedback.
-
Nothing should be running on port I have not tested this yet but since the websocket URL (where the upgrade happens) is known and if your using Apache HTTP Server 2.4.47 (or newer) you might be able to simplify the configuration further using something like the following ProxyPass /notifications http://localhost:8888/notifications upgrade=websocket
ProxyPass / http://localhost:8888/ |
Beta Was this translation helpful? Give feedback.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
-
So what is the recommended way of using websockets? |
Beta Was this translation helpful? Give feedback.
-
Apache httpdIn vaultwarden set Apache HTTP Server >= 2.4.47ProxyPass / http://localhost:8888/ upgrade=websocket Apache HTTP Server < 2.4.47ProxyPass / http://localhost:8888/
RewriteEngine on
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteCond %{HTTP:Connection} upgrade [NC]
RewriteRule ^/?(.*) "ws://localhost:8888/$1" [P,L] |
Beta Was this translation helpful? Give feedback.
-
How would those rules work with a non-root domain setup, I.E. https://xxx.yyy.zzz/bitwarden/.... |
Beta Was this translation helpful? Give feedback.
-
I am starting this discussion, because there are a few points that are not entirely clear to me. And maybe to others.
I am using the current main branch (at commit 44e9e1a). This code already has the support for websockets on the same port via rocket.
However, I am still using
WEBSOCKET_ENABLED=true
with the following Apache rewrite rules:In a PR discussion my question came up how to use the new implementation with
WEBSOCKET_ENABLED=false
.While the rewrite rule to port 3012 might not be necessary anymore, the protocol still needs to be changed, doesn't it?
The
ProxyPass / http://localhost:8888/
would pass traffic tohttp://localhost:8888/
:But web sockets use a different protocol. So what would happen, if a websocket connection was routed to
http://....
? Shouldn't it be proxied tows://....
?Thoughts?
Beta Was this translation helpful? Give feedback.
All reactions