我在本地計算機上設定了 jenkins 并嘗試訪問它。我只是http://127.0.0.1:8080/輸入 Chrome 的地址欄并按下 Enter 按鈕。因為我沒有登錄,所以它回傳一個帶有狀態的回應403,但回應體為空。這是下面網路截圖的第一行。
然后在此之后,它回傳另一個帶有登錄表單的 http 回應,即下面網路截圖中的第二行。
據我了解, http status 內沒有重定向功能403。它如何回傳兩個回應?

uj5u.com熱心網友回復:
我找到了內在的原因。希望它可以幫助任何對此感到好奇的人。
雖然回應 http 狀態是403,但它也回傳 html 內容,如下所示。
HTTP/1.1 403 Forbidden
Date: Fri, 03 Jun 2022 13:05:20 GMT
X-Content-Type-Options: nosniff
Content-Type: text/html;charset=utf-8
X-Hudson: 1.395
X-Jenkins: 2.332.3
X-Jenkins-Session: 48f49ae2
Content-Length: 548
Server: Jetty(9.4.43.v20210629)
<html>
<head>
<meta http-equiv='refresh' content='1;url=/login?from=/'/>
<script>window.location.replace('/login?from=/');</script>
</head>
<body style='background-color:white; color:white;'>
Authentication required
<!--
-->
</body>
</html>
在回應中,它包含http-equiv='refresh',瀏覽器接收此命令,并重定向頁面。
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/488428.html
