[HTTP] Origins, CROS, Preflight
Origins made up of three parts the data scheme, the hostname and the prot.
It is important to know that it is user broswere enforces the same origin policy, it is the client browser not allow you send the different origin request not the server.
CROS:
Client side send the request, server side will check wheterh "Access-Control-Allow-Origin" is the same as "Referer".
One problem for this is request is already send to server, include all the data. What we want is from client side, we just sent the min-info to check the CROS, instead of sending business data.
So there is Preflight request comes in to play.
Preflight request:
It sends OPTIONS methoda and with "Referer", so server only needs to check "Referer" and return "ACAO".
To check whether a request is a Preflight request, you need to see whether it has "OPTIONS" method in the request head.
But notice, if a request is come from a form , then it cannot be preflight. See MORE
Preflighted requests
Unlike simple requests (discussed above), "preflighted" requests first send an HTTP request by the
OPTIONS
method to the resource on the other domain, in order to determine whether the actual request is safe to send. Cross-site requests are preflighted like this since they may have implications to user data. In particular, a request is preflighted if:
- It uses methods other than
GET, HEAD
orPOST
. Also, ifPOST
is used to send request data with a Content-Type other thanapplication/x-www-form-urlencoded
,multipart/form-data
, ortext/plain
, e.g. if thePOST
request sends an XML payload to the server usingapplication/xml
ortext/xml
, then the request is preflighted.- It sets custom headers in the request (e.g. the request uses a header such as
X-PINGOTHER
)
[HTTP] Origins, CROS, Preflight的更多相关文章
- CROS跨域请求处理
1.什么是跨域? 跨域是指从一个域名的网页去请求另一个域名的资源.比如从www.baidu.com 页面去请求 www.google.com 的资源.跨域的严格一点的定义是:只要 协议,域名,端口有任 ...
- AJAX from S3 CORS fails on preflight OPTIONS with 403
解决办法: 将 <!-- Sample policy --> <CORSConfiguration> <CORSRule> <AllowedOrigin> ...
- Cross-origin resource sharing JSON with Padding 同源策略 JSONP 为什么form表单提交没有跨域问题,但ajax提交有跨域问题? XMLHttpRequest and the Fetch API follow the same-origin policy 预检请求(preflight request)
https://zh.wikipedia.org/wiki/跨来源资源共享 跨来源资源共享(CORS)是一份浏览器技术的规范,提供了 Web 服务从不同域传来沙盒脚本的方法,以避开浏览器的同源策略[1 ...
- SpringMVC解决跨域问题及CROS
CORS 首先因为最近在做一个前后端分离的项目,分开就意味着可能不在一个域中,所以不可避免的遇到CORS的问题.试过几个方法: Spring MVC 4.2.5以后新增的支持跨域的注解@CrossOr ...
- 使用Spring CROS解决项目中的跨域问题
CROS(Cross-Origin Resource Sharing) 用于解决浏览器中跨域请求的问题.简单的Get请求可以使用JSONP来解决,而对于其它复杂的请求则需要后端应用的支持CROS.Sp ...
- Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' heade
XMLHttpRequest cannot load http://10.164.153.37:8050/WebService/WebService.asmx/wsGetStreetData. Res ...
- 并查集(逆序处理):HDU 5652 India and China Origins
India and China Origins Time Limit: 2000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/ ...
- 让 QtWebkit 支持跨域CROS - nowboy的CSDN博客 - 博客频道 - CSDN.NET
让 QtWebkit 支持跨域CROS - nowboy的CSDN博客 - 博客频道 - CSDN.NET 让 QtWebkit 支持跨域CROS 2013-05-23 22:05 450人阅读 评论 ...
- Js 跨域CORS报错 Response for preflight has invalid HTTP status code 405
问题 公司项目H5调用接口遇到Response for preflight has invalid HTTP status code 405这样的错误,是使用PUT方式提交请求接口.Content-T ...
随机推荐
- 如何让Activiti-Explorer使用sql server数据库
从官网下载的Activiti-explorer的war文件内部默认是使用h2内存数据库的,如果想改用其他的数据库来做持久化,比如sql server,需要做如下配置. 1)修改db.propertie ...
- ANDROID_MARS学习笔记_S01原始版_010_ContentProvider
一.简介 一.代码1.xml(1)main.xml <?xml version="1.0" encoding="utf-8"?> <Linea ...
- QStringRef可以提高性能,下次注意使用;QPair方便了语法,函数可以一次返回多个返回值,方便使用
而且QPair从此与各种QMap容器联系了起来,会非常好用.甚至QList也可以成双成对的使用元素了: QList<QPair<int, double> > list;list ...
- Linux下删除大量文件
主要参考了http://www.slashroot.in/which-is-the-fastest-method-to-delete-files-in-linux 首先建立50万个文件 ➜ test ...
- in on at 总结
in,on,at的时间用法和地点用法 一.in, on, at的时间用法 ①固定短语: in the morning/afternoon/evening在早晨/下午/傍晚, at noon/night ...
- WCF - Overview
WCF stands for Windows Communication Foundation. The elementary feature of WCF is interoperability. ...
- poj3373Changing Digits(dp)
链接 dfs倒着搜 返回的路径不能满足相同的数最多 借鉴了下别人的代码.. 先dp出来 再倒着标记一下 然后正回来一定可以满足了 dp保存的是最小的不相同数 #include <iostream ...
- MySQL purge log简单吗
MySQL purge log简单吗? 简单: purge log的功能很简单,purge master logs to 指定一个binlog,然后删除之前的文件系统上的binlog文件,并更新bin ...
- 利用HttpWebRequest和HttpWebResponse获取Cookie
之前看过某个同学的一篇有关与使用JSoup解析学校图书馆的文章,仔细一看,发现竟然是同校!!既然对方用的是java,那么我也就来个C#好了,虽然我的入门语言是java. C#没有JSoup这样方便的东 ...
- 如何在小方框上打对号 小方框内打对勾 word 方框打对勾
在word中做选择时,很多人遇到需要在小方框上打对勾而不知如何做,现将可行的各种方法总结如下: 1:直接找到一个做好的,保存为图片,在需要的时候插入它: 2:插入文本框,然后边框选择为实线,在文本 ...