[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
OPTIONSmethod 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, HEADorPOST. Also, ifPOSTis used to send request data with a Content-Type other thanapplication/x-www-form-urlencoded,multipart/form-data, ortext/plain, e.g. if thePOSTrequest sends an XML payload to the server usingapplication/xmlortext/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 ...
随机推荐
- 李洪强漫谈iOS开发[C语言-018]-scanf函数
- ASP.NET MVC 入门介绍 (上)
MVC模式 MVC模式是一种软件架构模式.它把软件系统分为三个部分:模型(Model),视图(View)和控制器(Controller).MVC模式最早由Trygve Reenskaug在1974年提 ...
- Ubuntu nfs 配置
1. nfs server端的安装和配置 (1)安装nfs server sudo apt-get install nfs-kernel-server nfs-common (2)重启nfs serv ...
- session跨域共享解决方案
要让session跨域共享,需要解决三个问题: 1.通过什么方法来传递session_id? 2.通过什么方法来保存session信息? 3.通过什么方法来进行跨域? 一.传递session_id有4 ...
- 在Sublime Text 3中配置编译和运行Java程序
设置Java的PATH环境变量 在Java的jdk的bin目录下建立新文件runJava.bat 文件内容如下: @echo off cd %~dp1 echo Compiling %~nx1.... ...
- [Hadoop源码解读](五)MapReduce篇之Writable相关类
前面讲了InputFormat,就顺便讲一下Writable的东西吧,本来应当是放在HDFS中的. 当要在进程间传递对象或持久化对象的时候,就需要序列化对象成字节流,反之当要将接收到或从磁盘读取的字节 ...
- Webform——页面局部刷新
有一些数据控件,每次更改它的值后,都会重新查询数据库,然后再重新显示出来. 这样每次都会刷新全部页面,如果是一些信息量很庞大的页面,就会出现卡顿的现象,为了避免这种情况,就用到了局部刷新. 所用到的控 ...
- 全世界只有我们Erlang程序员是正确的
http://www.aqee.net/erlang-solving-the-wrong-problem/ 对某些程序来说是的,但对大多数程序来说不是.对大多数程序来说24个CPU中只有一个被利用.C ...
- scp linux远程拷贝和本地拷贝命令
linux远程拷贝和本地拷贝命令 一.linux对linux 远程拷贝 scp命令 scp 文件名 root@远程ip:/路径/ 将本地home目录下的test.tar的文件拷贝 ...
- python解析AMF协议
最近看公司同事在玩页游<斗破乾坤>我也进去完了一把,感觉画面还不错,就是不停的点鼠标做任务,一会就烦了,看了下前端配置文件,我们以error.json_3e30为例,这个肯定是记录错误码的 ...