![Apache 在 OPTIONS 方法中不返回允许标头](https://linux22.com/image/635331/Apache%20%E5%9C%A8%20OPTIONS%20%E6%96%B9%E6%B3%95%E4%B8%AD%E4%B8%8D%E8%BF%94%E5%9B%9E%E5%85%81%E8%AE%B8%E6%A0%87%E5%A4%B4.png)
我尝试从 Apache 服务器获取允许标头。我使用 curl 发送了请求。服务器返回标头,但没有返回“header allow”标头:
$ curl -v -X OPTIONS 10.0.0.1
* Rebuilt URL to: 10.0.0.1/
* Hostname was NOT found in DNS cache
* Trying 10.0.0.1...
* Connected to 10.0.0.1 (10.0.0.1) port 80 (#0)
> OPTIONS / HTTP/1.1
> User-Agent: curl/7.37.0
> Host: 10.0.0.1
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Sun, 15 Jun 2014 07:35:24 GMT
* Server Apache/2.2.22 (Ubuntu) is not blacklisted
< Server: Apache/2.2.22 (Ubuntu)
< X-Powered-By: PHP/5.3.10-1ubuntu3.7
< Vary: Accept-Encoding
< Content-Length: 1498
< Content-Type: text/html
<
我找不到设置标题的选项。
答案1
我可以Allow
在虚拟主机节中手动添加标头:
<VirtualHost ...>
...
Allow: GET,POST,PUT,DELETE,OPTIONS
...
</VirtualHost>
从 Chrome 开发者工具中:
...
Allow:GET, POST, PUT, DELETE, OPTIONS
...