|
墙怎样知道一个 HTTP 请求是发到哪里的?为探索这个问题(我在Windows上)安装MingGW(可通过安装Git自带MingGW),再下载netcat放在/usr/bin/ 下。
然后在墙外建立echo server用来测试,也可以用 echo.free.beeceptor.com 它是一个免费的echo server。
第一次测试:标头的Host为echo.free.beeceptor.com,发送请求至echo.free.beeceptor.com
- printf 'GET / HTTP/1.1\r\nHost: echo.free.beeceptor.com\r\nConnection: close\r\n\r\n' | ncat echo.free.beeceptor.com 80
复制代码
在墙内和墙外的结果相同,都是
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Content-Type: application/json
Date: Fri, 20 Sep 2024 16:52:07 GMT
Vary: Accept-Encoding
Connection: close
Transfer-Encoding: chunked
f3
{
"method": "GET",
"protocol": "http",
"host": "echo.free.beeceptor.com",
"path": "/",
"ip": "36.143.132.146:14234",
"headers": {
"Host": "echo.free.beeceptor.com",
"Accept-Encoding": "gzip"
},
"parsedQueryParams": {}
}
0
第二次测试:标头的Host为example.com,发送请求至echo.free.beeceptor.com
- HTTP/1.1 308 Permanent Redirect
- Connection: close
- Location: https://example.com/
- Server: Caddy
- Date: Fri, 20 Sep 2024 16:52:37 GMT
- Content-Length: 0
复制代码
在墙内和墙外的结果相同,都是
HTTP/1.1 308 Permanent Redirect
Connection: close
Location: https://example.com/
Server: Caddy
Date: Fri, 20 Sep 2024 16:52:37 GMT
Content-Length: 0 |
|