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

GET https://localhost/sockjs-node/info?t=1580200999862 net::ERR_CONNECTION_REFUSED #497

Closed
marcoippolito opened this issue Jan 28, 2020 · 9 comments

Comments

@marcoippolito
Copy link

marcoippolito commented Jan 28, 2020

Ubuntu 18.04.03 Server Edition, nginx version: nginx/1.14.0 (Ubuntu), @vue/cli 4.1.2

These are the errors I'm getting:

GET https://localhost/sockjs-node/info?t=1580200999862 net::ERR_CONNECTION_REFUSED

In sockjs.js :

  try {
self.xhr.send(payload);
} catch (e) {
  self.emit('finish', 0, '');
  self._cleanup(false);
}

sockejsError05
sockejsError06

this is my /etc/nginx/conf.d/default.conf :

server {
    listen 443 ssl http2 default_server;
    server_name ggc.world www.ggc.world;

    ssl_certificate /etc/ssl/certs/chained.pem;
    ssl_certificate_key /etc/ssl/private/domain.key;
    ssl_session_timeout 5m;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
    ssl_ciphers EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
    ssl_prefer_server_ciphers on;
    ssl_session_cache shared:SSL:50m;
    ssl_dhparam /etc/ssl/certs/dhparam.pem;
    #ssl_stapling on;
    #ssl_stapling_verify on;

    access_log /var/log/nginx/ggcworld-access.log combined;

    add_header Strict-Transport-Security "max-age=31536000";
    location = /favicon.ico { access_log off; log_not_found off; }
    location / {
        proxy_pass http://127.0.0.1:8080;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
}

server {
    listen 80 default_server;
    listen [::]:80 default_server;
    error_page 497 https://$host:$server_port$request_uri;
    server_name ggc.world www.ggc.world;
    return 301 https://$server_name$request_uri;

    access_log /var/log/nginx/ggcworld-access.log combined;

    add_header Strict-Transport-Security "max-age=31536000";
    location = /favicon.ico { access_log off; log_not_found off; }
    location / {
        proxy_pass http://127.0.0.1:8080;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    } 
 }

How to solve the problem?

This was referenced Jan 28, 2020
@brycekahle
Copy link
Contributor

Does it work if you bypass nginx and connect directly to port 8080?

@marcoippolito
Copy link
Author

Sorry @brycekahle .. how to bypass nginx?

@brycekahle
Copy link
Contributor

Use localhost:8080 in your sockjs-client connection string instead of localhost.

@marcoippolito
Copy link
Author

I beg your pardon, but may be I'm missing something. As you might grasped, I'm not such an expert:
are you referring as "sockjs-client connection string" to something in nginx configuration or something else? But where exactly?

@brycekahle
Copy link
Contributor

When you create the SockJS object with var sock = new SockJS('https://localhost/sockjs-node');. Have you tried localhost:8080 instead of localhost? Also, you probably don't want https for local testing. That may be the real issue, since the error you are getting is ERR_SSL_PROTOCOL_ERROR. Start simple, get it working, and then add more complexity (nginx, etc.).

@marcoippolito
Copy link
Author

Actually I didn't create any SockJS object by myself.
I just created a brand new tiny webapp with vue cli, so without adding anything, apart from what the empty vue-cli scaffolding brings.

(base) marco@pc:~/vueMatters/testproject$ npm run serve

[email protected] serve /home/marco/vueMatters/testproject
vue-cli-service serve

INFO Starting development server...
98% after emitting CopyPlugin

DONE Compiled successfully in 1409ms 8:14:46 PM

I need https for testing, since I need to use and test tools as webRTC within my local network and also with external networks. So, it would be better to find a way to work with https

@brycekahle
Copy link
Contributor

If you didn't directly create a SockJS object yourself, then this repo is not the place to be troubleshooting. You should ask the Vue.js folks how you can setup local testing with https.

@marcoippolito
Copy link
Author

ok. Thank you @brycekahle

@marcoippolito
Copy link
Author

@brycekahle In the PC I installed ex-novo Ubuntu 18.04.3 Desktop and I verified that the problem disappeared.

I ran the same tiny webapp in both laptop and pc, and using localhost and the ip-address both from within the laptop/PC and from the other device (PC/laptop) gave no error.
I reported everything here:
https://askubuntu.com/questions/1207812/webapp-fails-with-neterr-connection-refused-with-ubuntu-18-04-4-server-edition

According to you, what kind of problems/missing parts/lacking features or whatever the Ubuntu 18.04.4 Server Edition could have compared to the Ubuntu 18.04.4 Desktop Edition?
It would be great if we could give to the Ubuntu's people some hints/suggestions and help in solving this problem.

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

2 participants