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

Running on sub-domain with Nginx Terminated SSL #38

Open
ghost opened this issue Nov 17, 2020 · 0 comments
Open

Running on sub-domain with Nginx Terminated SSL #38

ghost opened this issue Nov 17, 2020 · 0 comments

Comments

@ghost
Copy link

ghost commented Nov 17, 2020

Hey Will,

I'm attempting to create a simple ratchet socket server as a Lumen microservice to make it really simple to get websockets implemented into a project or homestead box.

But I'm wondering how to get this set up. It should be served via domain or sub-domain so that users can run laravel-echo-ratchet

import Echo from 'laravel-echo-ratchet'

window.Echo = new Echo({
    broadcaster: 'ratchet',
    host: 'wss://ratchet.example.com',
});

Nothing else will run in the service so it can simply run on port 443 and terminate upstream to the actual ratchet server, or on port 80 if the user would for some reason not want to use SSL.

But when I try to fire up the server php artisan ratchet:serve --driver=WsServer -z using an actual hostname I get an error:

Given URI "tcp://example.test:8080" does not contain a valid host IP

So ... I set my host to 127.0.0.1 and port 8080

I set up nginx with the following upstream:

upstream ratchet {
   server 127.0.0.1:8080;
}

Then in my server block for port 443

location / {
   proxy_pass http://ratchet;
   proxy_read_timeout 60;
   proxy_connect_timeout 60;
   proxy_redirect off;
   proxy_http_version 1.1;
   proxy_set_header Upgrade $http_upgrade;
   proxy_set_header Connection 'upgrade';
   proxy_set_header Host $host;
   proxy_cache_bypass $http_upgrade;
}

The server and zmq socket start up fine ...

but when I try to connect via the test app with:

var ws = new WebSocket('wss://example.test');

// or 

var ws = new WebSocket('wss://example.test:443');

I get this:

code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE'

Do you think this is something specific to Homestead? My certificates are all up to date and functioning.

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

0 participants