Node https request returned code: 'ECONNRESET',

const https = require("https");

var options = {
    hostname: "web.4jc33.com",
    port: 80,
    path: "/lotts/times?ids=cqssc",
    headers: {
        "Content-Type": "application/json; charset=utf-8",
        "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36",
        "Referer": "https://web.4jc33.com/lotts/cqssc/index",
        "Cookie": "guide1=xianyu; openSwitching=n657; JSESSIONID=4BA58696365A8AD51F0A5802A80D44306C693CEA"
    },
 };


https.get(options, (res) => {
  console.log("statusCode:", res.statusCode);
  console.log("headers:", res.headers);

  res.on("data", (d) => {
    process.stdout.write(d);
  });

}).on("error", (e) => {
  console.error(e);
});

// 

{ Error: socket hang up
    at TLSSocket.onHangUp (_tls_wrap.js:1135:19)
    at Object.onceWrapper (events.js:313:30)
    at emitNone (events.js:111:20)
    at TLSSocket.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1056:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
  code: "ECONNRESET",
  path: null,
  host: "web.4jc33.com",
  port: 80,
  localAddress: undefined }
The

code is as above. The link requesting https cannot be returned correctly, and the browser can open

.
Mar.21,2021

resolved: https default port 443

  • Nginx client_header_buffer_size has no effect

    An API service I built myself uses https. The get request parameter of a user is too long, and then the browser cannot access it directly. After shortening the parameters in url, you can. the server uses nodejs local test parameters that can be handled...

    Mar.15,2021
Menu