Giter Club home page Giter Club logo

Comments (14)

mrspence avatar mrspence commented on May 18, 2024 6

Try using the .pem files generated by LetsEncrypt instead - Source

Your options (either through JSON or the CLI) should instead look like this:

var options = {
    authHost: 'https://example.org',
    host: 'https://example.org',
    port: '6001',
    sslCertPath: ' /etc/letsencrypt/live/www.example.org/fullchain.pem',
    sslKeyPath: '/etc/letsencrypt/live/www.example.org/privkey.pem'
};

from laravel-echo-server.

jonnywilliamson avatar jonnywilliamson commented on May 18, 2024 2

@tlaverdure could you link to any discussion online you're having with Taylor about this issue as this was the reason I decided to abandon using SSL and stick with regular http.

Having the SSL directories change every month when let's encrypt updates is a very big hassle.

Maybe if forge sent a callback to your server after a successful SSL update, containing the new paths to the SSL files we could do our own processing etc?

from laravel-echo-server.

rjchauhan avatar rjchauhan commented on May 18, 2024

+1

Everything is working fine on local with homestead, but not working on server over HTTPS.

from laravel-echo-server.

tlaverdure avatar tlaverdure commented on May 18, 2024

Are you guys including full paths to your your ssl certificate files?

from laravel-echo-server.

MyMediaMagnet avatar MyMediaMagnet commented on May 18, 2024

Yes, I believe so. Here is what I have.

var options = {
    authHost: 'https://mydomain.com',
    host: 'https://mydomain.com',
    port: '6001',
    sslCertPath: '/etc/nginx/ssl/nginx.crt',
    sslKeyPath: '/etc/nginx/ssl/nginx.key'
};

from laravel-echo-server.

tlaverdure avatar tlaverdure commented on May 18, 2024

Hmmm. I haven't fully tested this out on a remote server :) so bear with me. I wonder if this may be a permissions issue. Usually files and directories in the etc directory are only accessible by the root user. Could you try running with sudo or using a root user if you can?

from laravel-echo-server.

MyMediaMagnet avatar MyMediaMagnet commented on May 18, 2024

I just tried running

sudo node socket.js

and it still didn't seem to work for me. I'm seeing "ERR_CONNECTION_REFUSED" in my Chrome console.

from laravel-echo-server.

MyMediaMagnet avatar MyMediaMagnet commented on May 18, 2024

Just for a little bit of additional information. I'm currently running a LEMP setup on Laravel Forge. I'm using a key from Let's Encrypt which is automatically installed within Forge. The path that is being referenced for the keys in my nginx config file is '/etc/nginx/ssl/default/{unique_id}/nginx.crt'. These files, however, are empty and when I tried to use one it threw an error (something about it not being able to find the file) when I went to start the socket. I assumed there was some sort of connection being made between these files, and the files I'm referencing in my example in one of my previous comments. When I changed the socket.js file to reference the files above, it would allow me to start the socket just fine.

from laravel-echo-server.

MyMediaMagnet avatar MyMediaMagnet commented on May 18, 2024

I made a couple changes and now am start to see the following "ERR_INSECURE_RESPONSE".

from laravel-echo-server.

tlaverdure avatar tlaverdure commented on May 18, 2024

Gotcha, yeah if the files are not found, the server will not run properly. In the next release there will be some better error logging to help diagnose these type of things.

On Laravel forge, when certificates are renewed, it looks like the directory of the certificate files change. I understand that it may be cumbersome to keep up with these, but the paths will need to remain updated in order to run the server with SSL. As this falls outside of the actual configuration of the server, and more so the location of the ssl certificates files I'm going to close this and ping @taylorotwell.

A possible solution for Laravel Forge and other instances of this issue may be to perform an "atomic" deployment of the certificates by creating a symlink when the SSL certificates are installed.

So each time the certificate is refreshed, the active directory:

/etc/nginx/ssl/SITE/UNIQUE_ID

would be symlinked to:

/home/forge/ssl/SITE/

from laravel-echo-server.

MyMediaMagnet avatar MyMediaMagnet commented on May 18, 2024

Thanks for the suggestions @tlaverdure. I was able to get it working with a combination of setting the ssl files to the ones located within the unique_id folders, combined with using sudo when running "sudo node socket.js".

I'm not able to get it running however using pm2. Even when I run sudo pm2 start socket.js it doesn't seem to work. This seems especially important since I seem to be getting an error "Unexpected token a in JSON at position 0" quite often that crashes the service.

Unexpected token a in JSON at position 0
at Object.parse (native)
at Redis._redisPubSub.on (/home/forge/default/node_modules/laravel-echo-server/dist/echo-server.js:66:28)

from laravel-echo-server.

vesper8 avatar vesper8 commented on May 18, 2024

having the same problem here.

Am able to get it to work over https if I run sudo laravel-echo-server start with the json config file pointing to the /etc/nginx files. But can't get it to run using PM2

Also hadn't even realized that the ssl cert path will be changing on a periodic basis which is a big hassle for sure.

in the past I managed to get something similar to this to work by using supervisor so I'll look into that

if anyone knows how to get this to work with PM2 or finds a clean solution to the changing paths please let me know.

I guess sudo is only needed because the ssl cert is located in a root-owned path so a workaround that might be useful too

from laravel-echo-server.

nguyenphuocnhatthanh avatar nguyenphuocnhatthanh commented on May 18, 2024

I same issue ... pls help me

from laravel-echo-server.

tylik1 avatar tylik1 commented on May 18, 2024

For me in local environment it didn't work with host: "https://example.org". I changed it back to host: null, but this value should be in: authHost: "https://example.org"

from laravel-echo-server.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.