![Nginx & Reverse Proxy Nginx & Reverse Proxy](https://image.shishitao.com:8440/aHR0cHM6Ly9ia3FzaW1nLmlrYWZhbi5jb20vdXBsb2FkL2NoYXRncHQtcy5wbmc%2FIQ%3D%3D.png?!?w=700&webp=1)
Nginx & Reverse Proxy
https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/
node.js http/https server
// const http = require(`http`);
const https = require(`https`);
/*
https://nodejs.org/api/http.html
https://nodejs.org/api/https.html
https://nodejs.org/api/http2.html
*/
//$ node ./src/node-server.js
// req: https.clientRequest
const req = https.get(
`https://abc.xgqfrms.xyz/`,
// `https://www.xgqfrms.xyz/`,
// `https://www.google.com/`,
(res) => {
// res: https.IncomingMessage
console.log(`res.statusCode = `, res.statusCode);
console.log(`res.headers = `, res.headers);
const ip = res.socket.remoteAddress;
const port = res.socket.remotePort;
// res.end(`Your IP address is ${ip} and your source port is ${port}.`);
res.on(
`data`,
(data) => {
console.log(`data = \n`, data.toString());
}
);
}
);
req.on(`error`, err => console.log(`error = \n`, err));
console.log(`req.agent = `, req.agent);