V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
iweblogv2ex
V2EX  ›  Node.js

nodejs http request 返回内容

  •  
  •   iweblogv2ex · Sep 3, 2013 · 8375 views
    This topic created in 4628 days ago, the information mentioned may be changed or developed.
    var http = require('http');

    http.createServer(function(request, response) {
    var proxyRequest = http.request({
    host: request.headers['host'],
    port: 80,
    path: request.url,
    method: request.method,
    headers: request.headers
    }, function(proxyResponse) {
    console.log(proxyResponse.headers);
    response.writeHead(proxyResponse.statusCode, proxyResponse.headers);
    proxyResponse.pipe(response);
    });
    request.pipe(proxyRequest);
    }).listen(8080);

    请问怎么修改proxyResponse的html?
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1140 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 23:51 · PVG 07:51 · LAX 16:51 · JFK 19:51
    ♥ Do have faith in what you're doing.