2014-07-18 80 views
2

我正在捲曲到我擁有的服務器並獲得響應。但是這個迴應缺少一個Location字段。任何人都可以幫我弄清楚爲什麼會發生這種情況?cURL響應失蹤位置字段

這是捲曲:

curl -I http://example.server.net/ 

而且這個反應我得到:

HTTP/1.1 200 OK 
Date: Fri, 18 Jul 2014 15:08:53 GMT 
Server: Apache/2.2.22 (Ubuntu) 
Content-Length: 15 
Vary: Accept-Encoding 
Content-Type: 

正如你可以看到有沒有與類似迴應位置字段:

Location: http://example.server.net 

我知道這是來自其他捲髮的有效領域。我正在尋找爲什麼一些基本領域可能不顯示和可能的解決方案的原因

謝謝!

回答

0

響應代碼爲3xx時,您將獲得Location標題。

例如:

$ curl -I http://g.cn 
HTTP/1.1 301 Moved Permanently 
Location: http://www.google.cn/ 
Date: Fri, 18 Jul 2014 15:29:10 GMT 
Expires: Fri, 18 Jul 2014 15:29:10 GMT 
Cache-Control: private, max-age=2592000 
Content-Type: text/html; charset=UTF-8 
Server: gws 
Content-Length: 218 
X-XSS-Protection: 1; mode=block 
X-Frame-Options: SAMEORIGIN 
Alternate-Protocol: 80:quic,80:quic 
+0

感謝您的解釋。無論如何要得到一個200響應代碼的位置響應? – suavesav

+0

「位置」用於重定向。當代碼是200時,我們不需要重定向。 – kev