I’m currently trying to set up websockets with socketio and laravel-echo-server with Laravel as my API and React as my front-end. I have everything set up properly except I can’t access port 6001 over https.
Whenever I navigate to https://api.mysite.com:6001/socket.io/?EIO=4&transport=websocket, which is where my websockets are hosted, I should get a response, but all I get is ERR_CONNECTION_REFUSED or ERR_INVALID cert since it’s not allowing me to access port 6001 over https.
Is there a way to do this?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi there,
What I would personally do is to use an Nginx server as a reverse proxy. That way you could install an SSL certificate via Nginx and then proxy the traffic to the Laravel echo server.
The proxy rule would look as follows:
location /ws/{
proxy_pass http://127.0.0.1:6001/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Forwarded-For $remote_addr;
}
Then rather than using https://your_domain:6001 in your frontend, you would use https://your_domain/ws which would internally proxy the traffic to the echo server.
Let me know how it goes! Best, Bobby
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.