Open Bug 1502166 Opened 6 years ago Updated 2 years ago

DevTools network tab doesn't handle 421 misdirected request well

Categories

(DevTools :: Netmonitor, defect, P3)

60 Branch
defect

Tracking

(Not tracked)

People

(Reporter: kbolino, Unassigned)

References

(Blocks 1 open bug)

Details

User Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0 Steps to reproduce: Outside of Firefox: 1. Have a server that returns 421 "Misdirected Request" in some cases, e.g. when supporting HTTP/2 and acting as a reverse proxy and serving multiple domains from different backend servers 2. Configure the server to log requests Inside Firefox (I'm using 60.2.1esr): 3. Open the network tab and check "Persist Logs" 4. Issue one or more requests to that server in such a way that one of them gets a 421 "Misdirected Request" response, e.g. issue a request for one domain then another request for a different domain that is served by a different proxy 5. Observe the lines in the network tab Outside of Firefox: 6. Compare with the server's request log Actual results: In the network tab, there is only 1 line for what is in actuality 2 requests: the original, which received a 421 response code, and the redirected request, which received a different response code, headers, and body. The line shows the headers and body of the redirected request, but the response code of the original request (i.e., 421). The original response body and headers are lost, and so is the response code from the redirected request. Expected results: Some possibilities: 1. Show two lines, one for the original request that received a 421 response and one for the redirected request, clearly identifying that two requests were made and making the response code for the second request available 2. If the redirected request gets a response, replace its line entirely with the new response; this may be the intended behavior already, but if so it isn't working properly, as the response code stays 421 3. Like 2, except with some indication from the UI that the request was misdirected originally

Thanks for the report!

Sorry for the delay. Could you please provide an online page I could use to reproduce the problem?

Honza

Flags: needinfo?(kbolino)

Here's a page for demonstration:

https://firefox-421-demo-ngx17mpmt.now.sh/

The request in question is of the form /misdirected?token=randomhex

The server responds to the requests in this fashion:

  1. The first time it receives a certain token, it stores the token internally in a cache and responds with 421 status code and header X-Dummy-Header: foo

  2. The second time it receives the same token, it removes the token from the cache and responds with 200 status code and header X-Dummy-Header: bar

The client simply issues an XMLHTTPRequest once. Firefox automatically issues a second request when the first one receives a 421 response.

In the Network tab of the Dev Tools, after both requests have been issued, you will see only 1 line for /misdirected?token=... with a 421 response code but X-Dummy-Header: bar. There is no way to discover that the original 421 response set X-Dummy-Header: foo (which could, in a more realistic scenario, be a header providing diagnostic information on why the response was misdirected), nor that the final response had status code 200.

For comparison, although I'm not endorsing the behavior as better, Chrome also shows a single line in the developer tools but it has the 200 code and X-Dummy-Header: bar.

Flags: needinfo?(kbolino)

Thanks for the detailed explanation about how to reproduce the problem!

I can see that the behavior is different in Firefox/Chrome.

Honza

Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.