我开始正确地学习 http。
我在灯塔工作。
在命令行上,我请求一个本地页面,该页面将与 apache 一起提供以查看返回的 header 。
curl -i local.testsite
我请求的页面没有内容,我也没有设置任何标题,但是响应中已经发送了很多标题,例如:
HTTP/1.1 200 OK
Date: Thu, 17 Jan 2013 20:28:52 GMT
Server: Apache/2.2.22 (Ubuntu)
X-Powered-By: PHP/5.3.10-1ubuntu3.4
Vary: Accept-Encoding
Content-Length: 0
Content-Type: text/html
如果我不设置这些,apache 会自动设置这些吗?
最佳答案
是的,Apache 默认设置这些。顺便说一句,如果你只关心标题,你应该使用
curl -I local.testsite
-I
仅返回 header (HTTP HEAD 请求),这样即使页面上有内容,您也只会获得 header 。
关于apache - 自动设置 HTTP header ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14387576/