Home > Mobile >  One http request with two http response in Chrome
One http request with two http response in Chrome

Time:06-03

I set up jenkins in my local computer and try to visit it. I just put http://127.0.0.1:8080/ in the address bar of Chrome and push the Enter button. Because I have not loggin, it returns a response with status 403, but empty response body.This is the first line in below network screenshot.

Then after this, it returs another http response with login forms, the second line in below netwrok screenshot.

As I understand, there is no redirect function inside http status 403. How does it return two response?

enter image description here

CodePudding user response:

I find out the inner reason. Hope it can help anyone who is also curious about this.

Although the response http status is 403, but it also returns html content as below.

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>  

In the response, it contains http-equiv='refresh', the browser receives this command, and it redirctes the page.

  • Related