[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 ...
随机推荐
- http://sofar.blog.51cto.com/353572/1540874
http://sofar.blog.51cto.com/353572/1540874 http://singlefly.blog.51cto.com/4658189/1368579 http://ww ...
- 查看java的.class文件的方法
在不通过eclipse等IDE安装反编译插件的情况下查看java的.class文件的方法:可以通过下载jd-gui class文件查看工具进行查看.如附件的“jd-gui.exe”程序. 1. 从网上 ...
- [jobdu]二叉树的镜像
树的镜像,这里的做法就是先序遍历的反过来呗. #include <iostream> #include <vector> using namespace std; void p ...
- 快速扫描文本文件,统计行数,并返回每一行的索引位置(Delphi、C#)
由项目需要,需要扫描1200万行的文本文件.经网友的指点与测试,发现C#与Delphi之间的差距并不大.不多说,列代码测试: 下面是Delphi的代码: //遍历文件查找回车出现的次数 functio ...
- C#技术------垃圾回收机制(GC)
GC的前世与今生 虽然本文是以.NET作为目标来讲述GC,但是GC的概念并非才诞生不久.早在1958年,由鼎鼎大名的图林奖得主John McCarthy所实现的Lisp语言就已经提供了GC的功能,这是 ...
- VS2012、VS2010、VS2008常用的快捷键
下面为大家带来VS各个版本常用的快捷方式,希望对大家开发过程中有帮助: 强迫智能感知:Ctrl+J: 强迫智能感知显示参数信息:Ctrl-Shift-空格: Ctrl+E,D ----格式化全部代码 ...
- .NET的类型层次查看工具
上周为了快速了解一个.NET的库而需要查看其类型层次.假如要在文章中表示一个类型层次,还是用文本比较舒服,截图始终是不方便.Reflector虽然能够显示类型层次,但我无法方便的把显示出来的类型层次转 ...
- WordPress Kernel Theme ‘upload-handler.php’任意文件上传漏洞
漏洞名称: WordPress Kernel Theme ‘upload-handler.php’任意文件上传漏洞 CNNVD编号: CNNVD-201311-127 发布时间: 2013-11-12 ...
- VM Depot 分布式计算框架主题应用精选
发布于 2014-12-24 作者 陈 忠岳 在前几期为各位介绍了大数据应用主题以及开发运营主题的各类镜像后,这次我们精选了 VM Depot 站点中分布式计算相关主题的虚拟机镜像和大家一起分享 ...
- PLS-00306:错误解决思路 - OracleHelper 执行Oracle函数的坑
如果你是像我一样初次使用Net+Oracle的结合,我想你会跟我一样,有很大的概率碰到这个问题 ==================================================== ...