[GH-ISSUE #708] Cannot get notifications / websockets work on apache #478

Closed
opened 2026-03-03 01:29:44 +03:00 by kerem · 5 comments
Owner

Originally created by @totti4ever on GitHub (Nov 5, 2019).
Original GitHub issue: https://github.com/dani-garcia/vaultwarden/issues/708

I am getting a 404 when opening https://bw.domain.tld/notifications/hub/negotiate in my browser and an error message when I open https://bw.domain.tld/notifications/hub:
{"ErrorModel":{"Message":"'/notifications/hub' should be proxied to the websocket server or notifications won't work. Go to the README for more info.","Object":"error"},"Message":"","Object":"error","ValidationErrors":{"":["'/notifications/hub' should be proxied to the websocket server or notifications won't work. Go to the README for more info."]},"error":"","error_description":""}

Any ideas on what I did wrong? Rest is working smoothly and perfectly! Am I just testing wrongly? Should I do something else than open the URLs in browser?

P.S.: I am using docker-compose and have enabled websockets and declared port 3012

<VirtualHost` *:443>

    SSLEngine on
    SSLProxyEngine On

    ServerName bw.domain.tld

    SSLCertificateFile /etc/letsencrypt/live/bw.domain.tld/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/bw.domain.tld/privkey.pem
    Include /etc/letsencrypt/options-ssl-apache.conf

    ErrorLog ${APACHE_LOG_DIR}/bw_error.log
    CustomLog ${APACHE_LOG_DIR}/bw_access.log combined

    RewriteEngine On
    RewriteCond %{HTTP:Upgrade} =websocket [NC]
    RewriteRule /notifications/hub(.*) ws://127.0.0.1:3012/$1 [P,L]

    ProxyPass / https://127.0.0.1:8443/
 #   ProxyPassReverse / https://127.0.0.1:8443/

    ProxyPreserveHost On
    ProxyRequests Off
    RequestHeader set X-Real-IP %{REMOTE_ADDR}s
# RequestHeader setifempty Connection "Upgrade"
# RequestHeader setifempty Upgrade "websocket"


</VirtualHost>
Originally created by @totti4ever on GitHub (Nov 5, 2019). Original GitHub issue: https://github.com/dani-garcia/vaultwarden/issues/708 I am getting a 404 when opening https://bw.domain.tld/notifications/hub/negotiate in my browser and an error message when I open https://bw.domain.tld/notifications/hub: `{"ErrorModel":{"Message":"'/notifications/hub' should be proxied to the websocket server or notifications won't work. Go to the README for more info.","Object":"error"},"Message":"","Object":"error","ValidationErrors":{"":["'/notifications/hub' should be proxied to the websocket server or notifications won't work. Go to the README for more info."]},"error":"","error_description":""}` Any ideas on what I did wrong? Rest is working smoothly and perfectly! Am I just testing wrongly? Should I do something else than open the URLs in browser? P.S.: I am using docker-compose and have enabled websockets and declared port 3012 ``` <VirtualHost` *:443> SSLEngine on SSLProxyEngine On ServerName bw.domain.tld SSLCertificateFile /etc/letsencrypt/live/bw.domain.tld/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/bw.domain.tld/privkey.pem Include /etc/letsencrypt/options-ssl-apache.conf ErrorLog ${APACHE_LOG_DIR}/bw_error.log CustomLog ${APACHE_LOG_DIR}/bw_access.log combined RewriteEngine On RewriteCond %{HTTP:Upgrade} =websocket [NC] RewriteRule /notifications/hub(.*) ws://127.0.0.1:3012/$1 [P,L] ProxyPass / https://127.0.0.1:8443/ # ProxyPassReverse / https://127.0.0.1:8443/ ProxyPreserveHost On ProxyRequests Off RequestHeader set X-Real-IP %{REMOTE_ADDR}s # RequestHeader setifempty Connection "Upgrade" # RequestHeader setifempty Upgrade "websocket" </VirtualHost> ```
kerem closed this issue 2026-03-03 01:29:44 +03:00
Author
Owner

@BlackDex commented on GitHub (Nov 7, 2019):

@totti4ever Do you have SSL Enabled on the container?
If so, you probably need to change ws://127.0.0.1:3012 to wss://127.0.0.1:3012.
Note the extra "s" for "Secure".

<!-- gh-comment-id:551079490 --> @BlackDex commented on GitHub (Nov 7, 2019): @totti4ever Do you have SSL Enabled on the container? If so, you probably need to change ws://127.0.0.1:3012 to **wss**://127.0.0.1:3012. Note the extra "s" for "Secure".
Author
Owner

@cybis commented on GitHub (Nov 8, 2019):

Although websockets are working fine for me (docker container behind reverse proxy with SSL up to the proxy) I get a 404 error for https://bw.domain.tld/notifications/hub/negotiate and for https://bw.domain.tld/notifications/hub the error message WebSocket Protocol Error: Unable to parse WebSocket key. Am I dealing with a misconfiguration?

<!-- gh-comment-id:551965350 --> @cybis commented on GitHub (Nov 8, 2019): Although websockets are working fine for me (docker container behind reverse proxy with SSL up to the proxy) I get a 404 error for https://bw.domain.tld/notifications/hub/negotiate and for https://bw.domain.tld/notifications/hub the error message `WebSocket Protocol Error: Unable to parse WebSocket key.` Am I dealing with a misconfiguration?
Author
Owner

@totti4ever commented on GitHub (Nov 10, 2019):

@totti4ever Do you have SSL Enabled on the container?
If so, you probably need to change ws://127.0.0.1:3012 to wss://127.0.0.1:3012.
Note the extra "s" for "Secure".

Thanks for the advice, but still nothing changed?

<!-- gh-comment-id:552196262 --> @totti4ever commented on GitHub (Nov 10, 2019): > @totti4ever Do you have SSL Enabled on the container? > If so, you probably need to change ws://127.0.0.1:3012 to **wss**://127.0.0.1:3012. > Note the extra "s" for "Secure". Thanks for the advice, but still nothing changed?
Author
Owner

@mprasil commented on GitHub (Nov 11, 2019):

Did you try adding the extra setting as in #527? Maybe that will do the trick.

<!-- gh-comment-id:552400675 --> @mprasil commented on GitHub (Nov 11, 2019): Did you try adding the extra setting as in #527? Maybe that will do the trick.
Author
Owner

@dani-garcia commented on GitHub (May 13, 2020):

Closed due to inactivity.

<!-- gh-comment-id:628278335 --> @dani-garcia commented on GitHub (May 13, 2020): Closed due to inactivity.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vaultwarden#478
No description provided.