How does one go about implementing a HTTP proxy compared to implementing a HTTP webserver, what are the differences? Is there a definitive guide or RFC or a helpful book on this subject?
相关问题
- Angular RxJS mergeMap types
- Google Apps Script: testing doPost() with cURL
- How to instantiate Http service in main.ts manuall
- C#使用http访问网络,有办法用指定网卡访问网络嘛?
- PHP Empty $_POST
相关文章
- C#使用http访问网络,有办法用指定网卡访问网络嘛?
- Is a unicode user agent legal inside an HTTP heade
- git: retry if http request failed
- Flutter - http.get fails on macos build target: Co
- Angular CLI: Proxy websocket with proxy.conf.json
- OSX proxy issue with homebrew install
- C# HttpClient.SendAsync always returns 404 but URL
- Response body is null, status is 200
The requirements on HTTP Proxy servers are specified within
RFC7230 - Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing
The header sent to a proxy is different.
For example, here is what is sent by Google Chrome to www.baidu.com via a proxy server:
We can see it is
instead of
and here is
also
Host field is required for http proxy.
For HTTPS tunnel proxy:
We can see
domain:443
instead ofhttps://domain
.CONNECT field turn the proxy server to something like a TCP tunnel, then the protocol
HTTPS
is replaced by the port:443
For socks5 proxy, things become easy, because socks5 care nothing about higher protocol, you just tell it host and port.
A proxy is very similar to a server; the only difference is that, after parsing the request, it merely forwards it and returns the result*, rather than processing the request, itself. Because the proxy does not have to do the same amount of processing as a normal server, it can often get away with a far more minimal parsing of the requests than a full-fleded server, but otherwise it is the same idea.
*Some proxies implement additional caching. Some also futz with the response/request, but that is the evil kind of proxy, which hopefully you do not have in mind.