-2

I am trying to use https in live server but a proxy error is occurring.

const https = require('https');
const fs = require('fs');
const options = {
    key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
    cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem')
};

https.createServer(options, (req, res) => {
    res.writeHead(200);
    res.end('hello world\n');
}).listen(8000);

Proxy Error

The proxy server received an invalid response from an upstream server.

The proxy server could not handle the request GET /play.

Reason: Error reading from remote server

Stephen Kennedy
  • 20,585
  • 22
  • 95
  • 108
  • Could you add the error you're getting to your question? – jared Nov 01 '19 at 18:04
  • @jared error is : Proxy Error The proxy server received an invalid response from an upstream server. The proxy server could not handle the request GET /play. Reason: Error reading from remote server – user9317817 Nov 01 '19 at 18:07
  • @jared error is:Proxy Error The proxy server received an invalid response from an upstream server. The proxy server could not handle the request GET /play. Reason: Error reading from remote server – user9317817 Nov 01 '19 at 18:09
  • Proxy Error The proxy server received an invalid response from an upstream server. The proxy server could not handle the request GET /play. Reason: Error reading from remote server – user9317817 Nov 01 '19 at 18:12
  • Hi @user9317817, its generally best to edit your question with clarifications like this, rather than adding it to the comment thread, which may not be as obvious to future readers of your question. – robsiemb Nov 01 '19 at 18:16

1 Answers1

0

Prefer Using Node behind a reverse proxy such as Nginx and the SSL termination should be done at Nginx itself.

Nginx can also act as a load balancer and it's good at serving static files(which should ideally be done through a CDN).

Refer this link : Link

Rahul Yadav
  • 181
  • 6