This is a creation in
Article, where the information may have evolved or changed.
When request http://localhost:8080/html/home.html automatically forwards the request to http://192.168.0.1/html/home.html, with a cookie request, but the cookie is manually crawled every time
Package Mainimport ("Io/ioutil" "Log" "net/http"//"strings") Func statistic (w http. Responsewriter, R *http. Request) {//r.url. RequestUri () Client: = &http. Client{}req, Err: = http. Newrequest ("GET", "http://192.168.0.1" +r.url. Path, nil) if err! = Nil {log. Fatal (Err)}req. Header.set ("Cookie", ' sessionid=y151qxjszzop5d2lvfun0s/jpnffqudtaslywz+zisg6ngst1gpake2dchvn+hnffos6rfj6gwul+ y0pag+rpyysogafczsun919fxzle45ugp+ka6fzmcei9ew7mj4z;path=/; HttpOnly; ') resp, err: = client. Do (req) if err! = Nil {log. Fatal (Err)}defer resp. Body.close () body, err: = Ioutil. ReadAll (resp. Body) If err! = Nil {log. Fatal (Err)}w.header (). Set ("Content-type", resp. Header.get ("Content-type")) W.write (body)}func main () {mux: = http. Newservemux () Mux. Handlefunc ("/", statistic) Err: = http. Listenandserve (": 8080", MUX) if err! = Nil {log. Fatal ("Listenandserve:", Err)}}