当前位置:网站首页>Don't turn down, three sentences to clarify the origin of cross domain resource request errors
Don't turn down, three sentences to clarify the origin of cross domain resource request errors
2022-07-04 13:19:00 【Boyue classmate】
Don't turn down , Three sentences to clarify the origin of cross domain resource request errors
Many students always encounter cross domain problems in their work , For example, such an error report
Access to XMLHttpRequest at ' 'http://test.com.cn/get' from origin 'http://local.com.cn:8080' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
In fact, it is very simple to judge whether it is cross domain
Only agreement 、 domain name 、 Only when the ports are all the same can they be considered under the same domain , In other cases, there are cross domain !
The so-called agreement :https and http
The so-called domain name :test.com.cn and ai.test.com.cn It's different
So called port :80 Port and 8080 Ports are naturally different
Of course , Cross domain problems do not necessarily exist .
Because the cross domain problem is that the browser is for ajax A security restriction of a request : A page started ajax request , It can only be the path of the same domain name as the current page , This can effectively organize cross site attacks . in other words , The cross domain problem is aimed at ajax The limitation of , It's the browser's self-protection behavior .
Usually we use cors To solve the cross domain , You need to do some configuration for the back-end development students .
For simple and complex requests , There are two ways to deal with it . We will write an article on this tomorrow .
ps:CORS, yes HTML5 A feature of , It defines a way for browsers to interact with servers to determine whether cross domain requests are allowed .
You can add header information in the background to correspond to the front end , The permissions of the front-end sending request and the background control are compared with each other , So as to obtain the relevant permissions of the background , In this way, there is no cross domain problem .
边栏推荐
- ArcGIS uses grid processing tools for image clipping
- The old-fashioned synchronized lock optimization will make it clear to you at once!
- 「小技巧」给Seurat对象瘦瘦身
- 阿里云有奖体验:用PolarDB-X搭建一个高可用系统
- DVWA range exercise 4
- Golang sets the small details of goproxy proxy proxy, which is applicable to go module download timeout and Alibaba cloud image go module download timeout
- Xue Jing, director of insight technology solutions: Federal learning helps secure the flow of data elements
- 提高MySQL深分页查询效率的三种方案
- 强化学习-学习笔记1 | 基础概念
- 二分查找的简单理解
猜你喜欢

Alibaba cloud award winning experience: build a highly available system with polardb-x
![[leetcode] 96 and 95 (how to calculate all legal BST)](/img/d5/788c88064bce6a7c4499017908b3f2.jpg)
[leetcode] 96 and 95 (how to calculate all legal BST)

求解:在oracle中如何用一条语句用delete删除两个表中jack的信息

Xue Jing, director of insight technology solutions: Federal learning helps secure the flow of data elements

【云原生 | Kubernetes篇】深入了解Ingress(十二)

一个数据人对领域模型理解与深入

A data person understands and deepens the domain model

一文掌握数仓中auto analyze的使用

Runc hang causes the kubernetes node notready

golang 设置goproxy代理的小细节,适用于go module下载超时,阿里云镜像go module下载超时
随机推荐
ArcGis利用栅格处理工具进行影像裁剪
Implementation mode and technical principle of MT4 cross platform merchandising system (API merchandising, EA merchandising, nj4x Merchandising)
游戏启动后提示安装HMS Core,点击取消,未再次提示安装HMS Core(初始化失败返回907135003)
mysql三级分销代理关系存储
"Tips" to slim down Seurat objects
Cann operator: using iterators to efficiently realize tensor data cutting and blocking processing
使用Scrcpy投屏
Peak detection of measured signal
Sort merge sort
How real-time cloud interaction helps the development of education industry
【AI系统前沿动态第40期】Hinton:我的深度学习生涯与研究心法;Google辟谣放弃TensorFlow;封神框架正式开源
Etcd storage, watch and expiration mechanism
Is there an elegant way to remove nulls while transforming a Collection using Guava?
二分查找的简单理解
Excuse me, have you encountered this situation? CDC 1.4 cannot use timestamp when connecting to MySQL 5.7
Efficient! Build FTP working environment with virtual users
Besides, rsync+inotify realizes real-time backup of data
Fundamentals of container technology
WPF双滑块控件以及强制捕获鼠标事件焦点
《预训练周刊》第52期:屏蔽视觉预训练、目标导向对话