Chrome not showing OPTIONS requests in Network tab

2020-02-03 06:32发布

问题:

My web client application is setting HTTP POST requests via fetch API.

I see that OPTIONS preflight requests are sent via debugging proxy (Charles Proxy), but they are not displayed in Google Chrome Developer Tools\Network tab.

I don't have any filters setup on the network tab. I remember OPTIONS requests being visible there, but not anymore. How do I bring them back?

回答1:

You'll need to go to: chrome://flags/#out-of-blink-cors, disable the flag, and restart Chrome.

This is an expected behavior change according to:
https://bugs.chromium.org/p/chromium/issues/detail?id=995740#c1

I originally came across this via:
https://support.google.com/chrome/thread/11089651?hl=en



回答2:

I noticed the same thing. I get an error in Console:

Access to XMLHttpRequest at 'https://api.somedomain.com' from origin 'http://www.someotherdomain.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

This started happening for me on the last update of Chrome (to 76). I don't know what I was on previously but I restart my browser often.

Here is the response from HAR

{
   "status":0,
   "statusText":"",
   "httpVersion":"",
   "headers":[

   ],
   "cookies":[

   ],
   "content":{
      "size":0,
      "mimeType":"x-unknown"
   },
   "redirectURL":"",
   "headersSize":-1,
   "bodySize":-1,
   "_transferSize":0,
   "_error":"net::ERR_FAILED"
}