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

Hello, how can I setup websocket using nginx? #817

Open
hthammed21 opened this issue Jun 30, 2024 · 0 comments
Open

Hello, how can I setup websocket using nginx? #817

hthammed21 opened this issue Jun 30, 2024 · 0 comments

Comments

@hthammed21
Copy link

I have setup nginx.conf
server {
listen 8080;
server_name devtest.test;

	location / {
		proxy_pass http://devtest.test:8080;  # Adjust to match your WebSocket server
		proxy_http_version 1.1;
		proxy_set_header Upgrade $http_upgrade;
		proxy_set_header Connection "Upgrade";
		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;
	}
}

I have read many articles and tried how to setup websocket on nginx but I can't make it work, I always received [WebSocket connection to 'ws://devtest.test:8080/' failed]

It only happens when I open my nginx on laragon, but if I disable it my website will work fine.

and this is my code on the site var conn = new WebSocket('ws://devtest.test:8080');

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

1 participant