xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

Nginx & Reverse Proxy All In One

Nginx & Reverse Proxy All In One

https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/

https://www.digitalocean.com/community/tutorials/how-to-configure-nginx-as-a-web-server-and-reverse-proxy-for-apache-on-one-ubuntu-16-04-server

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);

refs



©xgqfrms 2012-2020

www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!

原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!


posted @ 2018-04-22 20:30  xgqfrms  阅读(262)  评论(3编辑  收藏  举报