Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does Chrome sometimes logs only the preflight request (and not the actual GET) when using CORS?

Tags:

UPDATE: If I go back to 'All' tab and then back to 'XHR' I see both requests, so I guess it's some kind of chrome bug?

The GET request completes successfully but I cannot inspect the response. This occurs randomly in some of the endpoints of my api.

Firefox always logs the response.

enter image description here

like image 209
stream7 Avatar asked Sep 11 '13 12:09

stream7


People also ask

What does preflight mean in Chrome?

Preflight requests are a mechanism introduced by the Cross-Origin Resource Sharing (CORS) standard used to request permission from a target website before sending it an HTTP request that might have side effects.

Why do CORS preflight?

A CORS preflight request is a CORS request that checks to see if the CORS protocol is understood and a server is aware using specific methods and headers. It is an OPTIONS request, using three HTTP request headers: Access-Control-Request-Method , Access-Control-Request-Headers , and the Origin header.

What triggers preflight request?

A CORS preflight OPTIONS request can be triggered just by adding a Content-Type header to a request — if the value's anything except application/x-www-form-urlencoded , text/plain , or multipart/form-data .


1 Answers

You can always have a better view of the network communication via

chrome://net-internals/#events

Maybe you'll find something blocking it before reaching the dev tools..

like image 79
nuc Avatar answered Oct 19 '22 08:10

nuc