Question

How to connect to https on port 6001

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?


Submit an answer

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!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

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