javascript - (CORS) How does the browser know when to do a pre-flight request - Stack Overflow

So I have been using CORS for a short time now, I just read up on how it works behind the scenes. My qu

So I have been using CORS for a short time now, I just read up on how it works behind the scenes.

My question is how does the browser know when to do a pre-flight request?

There is no issue involved right now, as the browser seems to be working fine, I am just a little bit curious. Because when I make the request, I am not giving it any information on whether or not it is CORS, yet it still knows to do a pre-flight.

So I have been using CORS for a short time now, I just read up on how it works behind the scenes.

My question is how does the browser know when to do a pre-flight request?

There is no issue involved right now, as the browser seems to be working fine, I am just a little bit curious. Because when I make the request, I am not giving it any information on whether or not it is CORS, yet it still knows to do a pre-flight.

Share Improve this question asked Jun 17, 2015 at 17:12 Qasim AhmedQasim Ahmed 1972 silver badges10 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 7

The browser will send a preflight request if:

  • You add custom headers to your request
  • You use a method other than GET, HEAD or POST
  • You use POST with an unusual Content-Type.

More details here: HTTP access control (CORS), Preflighted requests

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745095551a4610955.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信