Webpack Dev Server with NGINX proxy for https: net :: ERR_CONNECTION_CLOSED domain names

I installed the server hosting the angular2 -webpack-starter project for the nodejs front-end and backj site. By default, nginx has two proxy_pass for mapping connections to the right places on the server. ALMOST everything works as expected. BUT there is a problem with the proxy server sockjs-node/infothat really surprised me.

At startup, I see:

zone.js:1960 GET https://localhost:3000/sockjs-node/info?t=1490740454197 net::ERR_CONNECTION_CLOSED

Two proxies:

  location ^~ /server/ {
    proxy_set_header   X-Real-IP $remote_addr;
    proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header   Host      $host;
    proxy_set_header X-NginX-Proxy true;
    proxy_pass https://127.0.0.1:9000/;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
  }

  location ^~ / {
    #proxy_buffering    off;
    proxy_set_header   X-Real-IP $remote_addr;
    proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header   Host      $host;
    proxy_set_header X-NginX-Proxy true;
    proxy_pass http://127.0.0.1:3000/;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
  }

I looked at server-side other answers to this problem, but to no avail. I tried adding cors material to the front-end, which does not make sense, and this has no effect. I tried disabling proxy_buffering to no avail (as expected). I even added 'underscored_in_headers on;' in nginx, to no avail.

webpack-dev- -, , nginx , webpack-dev-, .

, .

0
1

, . .

_pass http://127.0.0.1:3000/ '. .

:

proxy_pass https://127.0.0.1:3000/;

devServer webpack.dev.js :

  https: true,
  https: {
    key: fs.readFileSync('/etc/apache2/certwork/xxx.key'),
    cert: fs.readFileSync('/etc/apache2/certwork/xxx.crt'),
    ca: fs.readFileSync('/etc/apache2/certwork/ssl-bundle.crt')
  },

. : https: true , , , cert, ca stuff.

:

enter image description here

:

enter image description here

https://localhost:3000 ' . IE. localhost! == parke.dynazu.com. , webpack-dev-, .

0

Source: https://habr.com/ru/post/1660347/


All Articles