Closed waggyman closed 11 months ago
I found the solution. You don't need to include the proxy_set_header Host
anymore in the nginx configuration. Since the websocket sharp server not rely on HTTP.
Once I remove the proxy_set_header Host
in the nginx conf. I can access the websocket using wss://mydomain.com/g11
Correct nginx configuration
server {
server_name mydomain.com;
root /var/www/laravelapp/public;
location /g11 {
proxy_pass http://server_ip_address:9050; # Assuming WebSocket server is running on port 9050
proxy_http_version 1.1; # you need to set this in order to use params below.
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
#
#proxy_set_header Host $host; #No need this because websocket not rely on HTTP
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/mydomain.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/mydomain.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
I found the solution. You don't need to include the
proxy_set_header Host
anymore in the nginx configuration. Since the websocket sharp server not rely on HTTP.Once I remove the
proxy_set_header Host
in the nginx conf. I can access the websocket usingwss://mydomain.com/g11
Alright, this is the solution. Thanks!
Hello there, currently I am facing some issue on deploying the Secured Websocket (WSS) using Websocket Sharp as the server.
Here is my code right now:
And here is the nginx configuration:
Then I am connecting using my NodeJS Client
And when I run my node js client using :
I got this error:
Is there any missing configuration that I made from above snippets?