Search code examples
javascriptajaxpostcorspreflight

is a CORS request with preflight time consuming?


I use an AJAX request to send data through POST to another domain. As my content-type is not standard (it's JSON format), a preflight request is needed. ( with request Method: OPTIONS)

As described in this cross domain XHR call chart from wikipedia

I am wondering if this is time consuming as the browser will have to reach the server twice or not ? Maybe it depends on each browser behavior ?

Do I gain some time by using content-type "plain-text" to avoid the preflight request instead ?


Solution

  • It's a request. It takes time. It shouldn't take a significant amount of time though, so don't prematurely optimise.