我最近使用Titanium-Web-Proxy编写了一个反向代理。
浏览器通过IP 127.0.0.1,80端口访问反向代理,反向代理将浏览器的请求转发到IP 127.0.0.1,2366端口的IIS服务器。
+---------+ Request +---------------+ +------------+
| +-------------> | | Request | |
| | | Reverse Proxy +---------------> | Web Server |
| | | | | |
| Browser | | 127.0.0.1 | | 127.0.0.1 |
| | | | Response | |
| | Response | 80 | <---------------+ 2366 |
| | <-------------+ | | |
+---------+ +---------------+ +------------+
Run Code Online (Sandbox Code Playgroud)
当我测试它时,反向代理没有按我预期的那样工作,浏览器返回 HTTP 400 错误。
Bad Request - Invalid Hostname
HTTP Error 400. The …Run Code Online (Sandbox Code Playgroud)