Apache-2.2

Apache 不在 OPTIONS 方法中返回允許標頭

  • November 29, 2014

我嘗試從 apache 伺服器獲取允許標頭。我用 curl 發送請求。伺服器返回標頭但不是“標頭允許”標頭:

$ 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
< 

我找不到設置標題的選項。

我能夠Allow在 Virtual-Host 節中手動添加標題:

<VirtualHost ...>
...
Allow: GET,POST,PUT,DELETE,OPTIONS
...
</VirtualHost>

來自 Chrome 開發者工具:

...
Allow:GET, POST, PUT, DELETE, OPTIONS
...

引用自:https://serverfault.com/questions/606336