Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't get websockets to work #518

Closed
poblabs opened this issue Jun 30, 2019 · 5 comments
Closed

Can't get websockets to work #518

poblabs opened this issue Jun 30, 2019 · 5 comments

Comments

@poblabs
Copy link

poblabs commented Jun 30, 2019

I'm using the latest version of bitwarden_rs (Version: 1.9.1-3fb63bbe) and my vault is working but I've noticed the instant sync from browser to browser is not working. I know mobile is not in scope.

I've followed the Wiki entry for enabling websockets. I've followed the Wiki entry for the Proxy examples (my use case is nginx). I have the proxy headers in place:

    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";

In my Synology Docker instance I have port 3012 mapped, and WEBSOCKET_ENABLED set to true.

image

All the endpoints within the reverse proxy are working except /notifications/hub. This returns an NGINX error 502 Bad Gateway, which is coming from my proxy.

So perhaps it's not listening to HTTP requests, which led me to check my Chrome console and I get these errors.

image

If I GET that HTTP location, /notifications/hub/negotiate I see something although the image doesn't load. I think this tells me that my proxy rules for this endpoint are working.

image

I'm not quite sure where to go from here. Thoughts?

@tanst
Copy link

tanst commented Jul 2, 2019

Your answer is here: #500 (comment)

@mprasil
Copy link
Contributor

mprasil commented Jul 2, 2019

Can you share relevant parts of nginx config? It seems like there is some issue routing /notifications/hub/negotiate or something around that.

@poblabs
Copy link
Author

poblabs commented Jul 2, 2019

Your answer is here: #500 (comment)

@tanst I'm not so sure that's my answer (I had said upfront that I knew mobile was out of scope)


@mprasil Here you go. I've truncated out all 80 to 443 forwarding and SSL Let's Encrypt stuff. That's pretty standard. If you want to see it I can add it.

  location / {
    proxy_pass http://192.168.0.10:8083;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
  }
  
  location /notifications/hub {
    proxy_pass http://192.168.0.10:3012/;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
  }
  
  location /notifications/hub/negotiate {
    proxy_pass http://192.168.0.10:8083/;
  }

One thing I've noticed is that I need the trailing slash on the proxy_pass if the location is not /. Which is why you see that. I'm open to trying anything that's suggested.

Does the order of the locations matter within the proxy config?

EDIT: For giggles I moved the location for /notifications/hub/negotiate upwards in the list and it made no difference.

@mprasil
Copy link
Contributor

mprasil commented Jul 7, 2019

I think you have extra slash at the end in the proxy_pass for the /notifications/hub/negotiate endpoint?

@poblabs
Copy link
Author

poblabs commented Jul 7, 2019

That was the fix. I could have sworn I tried it without that trailing slash. A bunch of my other proxy locations actually require the trailing slash otherwise the endpoints get concatenated (there's some nginx documentation on the trailing slash).

Anyways, thanks for the sanity check. Initial tests are working.

@poblabs poblabs closed this as completed Jul 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants