There may be such a need, node as the Web server through another Http/https Proxy server http or HTTPS request, nonsense said directly on the code we all understand:
Varhttp= Require(' HTTP ')VarOpt= {Host:' Put the proxy server IP or domain name here ',Port:' Put the proxy server's port number here ',Method:' POST ',Here's how it's sent.Path:' Https://www.google.com ', Here is the path to accessHeaders:{ Here's the request header that you want to send out. }}Here is the code that accepts the dataVarBody= ‘‘;VarReq=http.Request(Opt, function(Res) {Console.Log("Got Response:" +Res.StatusCode);Res.On(' Data ',function(D){Body+=D; }).On(' End ', function(){Console.Log(Res.Headers)Console. log (body). on ( ' ERROR ' , function (e{ Console. ( "Got error:" + e< Span class= "pun". message); }) req.
This allows us to specify the proxy server to make HTTPS requests, note here we are the Proxy server is the HTTP protocol, not HTTPS, the results will certainly be different depending on your proxy server.
GotResponse: 302{Location: ' https://www.google.com.tw/', ' Cache-control ': ' Private ', ' Content-type ': ' Text/html; Charset=utf-8 ', ' Set-cookie ': [ ' Pref=id=b3cfcb24798a7a07:ff=0:tm=1356078097:lm=1356078097:s=v_3qed0_gcw6-xum; Expires=sun, 21-dec-2014 08:21:37 GMT; path=/; Domain=.google.com ', ' Nid=67=qojf_z3w7klibpnz6xld__r0rygyyu7l_xidqmz3anjbfaddzhijme3qcx651yucne_irk_ 2jms8hf5fuxnl85me0ndrtn9iq0z2gw69n00orb970hphtbye0maogzit; Expires=sat, 22-jun-2013 08:21:37 GMT; path=/; domain=.google.com; HttpOnly ' ],P3p: ' cp= ' This was not a P3P policy! See http://www.google.com/support/accounts/bin/answer.py?hl=en&answer=151657 for more info. "',Date: ' Fri, Dec 08:21:37 GMT ',Server: ' GWS ', ' Content-length ': ' 223 ', ' X-xss-protection ': ' 1; Mode=block ', ' X-frame-options ': ' Sameorigin ',Via: ' 1.0 ***.****.com:80 (SQUID/2.6.STABLE21) ', ' Proxy-connection ': ' Keep-alive ' }<Html><HEAD><Meta HTTP-Equiv="Content-type"Content="Text/html;charset=utf-8"><title>302< Span class= "PLN" > moved</title></ head><body> <h1>302 moved</h1>the document has moved<a href= "Https://www.. Com. Tw/
Google returned a 302, tell us to jump, need to visit https://www.google.com.tw/this address
Nodejs sending HTTP requests via Proxy (request)