代理授權失敗的HTTP響應代碼應該是什麼?我知道407是請求代理授權的響應代碼。但是,一旦客戶端向代理髮送認證信息,並且如果它不正確,代理應該返回什麼?如果它返回401響應代碼,那麼客戶端將如何識別代理上的身份驗證失敗,而不是終端資源?代理授權失敗的HTTP響應代碼
4
A
回答
3
好,如果有一個401保護資源的授權失敗,服務器只是另一個401響應:
Request URL:https://mysite.com/myresource/
Request Method:GET
Status Code:401 Authorization Required
Request Headers
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Authorization:Digest username="gjggj", realm="apps", nonce="75602afa895d26f9796f3c9174cf83f3", uri="/misc/apps/", algorithm=MD5, response="9e113b10d3e95b590bdef0fc7c7c617b", qop=auth, nc=00000001, cnonce="61f73b73f6b33ea2"
Cache-Control:max-age=0
Connection:keep-alive
Host:game-point.net
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.57 Safari/537.17
Response Headers
Cache-Control:no-cache
Connection:close
Content-Length:534
Content-Type:text/html
Date:Wed, 13 Feb 2013 11:07:26 GMT
Pragma:no-cache
Server:Cherokee/1.0.8 (Debian GNU/Linux)
WWW-Authenticate:Digest realm="apps", nonce="75602afa895d26f9796f3c9174cf83f3", qop="auth", algorithm="MD5"
所以我說要對付407授權失敗是路儘管瀏覽器已發送授權信息,但服務器仍以407狀態碼進行響應;這表明代理仍然需要授權,並且僅僅因爲您仍然獲得407狀態代碼而意味着授權失敗。
2
從官方機構:
http://www.ietf.org/rfc/rfc2617.txt
If the origin server does not wish to accept the credentials sent
with a request, it SHOULD return a 401 (Unauthorized) response. The
response MUST include a WWW-Authenticate header field containing at
least one (possibly new) challenge applicable to the requested
resource. If a proxy does not accept the credentials sent with a
request, it SHOULD return a 407 (Proxy Authentication Required). The
response MUST include a Proxy-Authenticate header field containing a
(possibly new) challenge applicable to the proxy for the requested
resource.
相關問題
- 1. Maven錯誤 - 授權失敗:未經代理授權
- 2. 如何使用RSpec測試CanCan授權失敗的響應代碼?
- 3. 授權代碼授權
- 4. HTTP響應代碼不當的參數和失敗值
- 5. 返回成功/失敗的AJAX響應和HTTP狀態代碼
- 6. HTTP錯誤407需要代理授權
- 7. OAuth 2.0授權代碼中「代碼」的生命週期授權代碼授權代碼Grant
- 8. Hadoop - 提取失敗太多 - HTTP響應代碼:500
- 9. REST API請求失敗HTTP響應代碼
- 10. HTTP規格:代理授權和授權頭
- 11. 代理授權:HTTPS的基本標頭失敗
- 12. Spotify授權代碼
- 13. 什麼應該是一個HTTP響應代碼缺乏PHP會話授權
- 14. 授權失敗
- 15. 失敗的HTTP刪除操作的HTTP響應代碼是什麼?
- 16. JMeter Recording:401將HTTP代理更改爲localhost後未經授權的響應
- 17. JMeter HTTP響應代碼200
- 18. 代碼= -1011「請求失敗:未經授權(401)」 AFNetwoking
- 19. Capistrano從bitbucket存儲庫部署代碼獲取「授權失敗」
- 20. Jmeter:響應代碼:非HTTP響應代碼:javax.net.ssl.SSLHandshakeException
- 21. 響應代碼:非HTTP響應代碼:org.apache.http.conn.HttpHostConnectException
- 22. node.js http代理和域\用戶:密碼授權
- 23. Android的授權驗證庫服務器響應代碼
- 24. USPS:API授權失敗
- 25. 2checkout授權失敗
- 26. Eclipse代理授權異常
- 27. Internet Explorer Internet失敗HTTP狀態代碼
- 28. java.lang.RuntimeException:失敗:HTTP錯誤代碼:500
- 29. RPC失敗;結果= 28,HTTP代碼= 0
- 30. PHP捲曲http代碼100和失敗
是。這回答了所有問題。謝謝! – MediumOne 2013-02-14 08:00:11