当前位置:网站首页>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 .
边栏推荐
- Cann operator: using iterators to efficiently realize tensor data cutting and blocking processing
- 从0到1建设智能灰度数据体系:以vivo游戏中心为例
- PostgreSQL 9.1 soaring Road
- Valentine's Day confession code
- AI painting minimalist tutorial
- Deploy halo blog with pagoda
- After the game starts, you will be prompted to install HMS core. Click Cancel, and you will not be prompted to install HMS core again (initialization failure returns 907135003)
- Alibaba cloud award winning experience: build a highly available system with polardb-x
- 聊聊支付流程的设计与实现逻辑
- [Android kotlin] lambda return statement and anonymous function
猜你喜欢
Transformer principle and code elaboration (tensorflow)
Transformer principle and code elaboration (pytorch)
Solution: how to delete the information of Jack in two tables with delete in one statement in Oracle
美团·阿里关于多模态召回的应用实践
DGraph: 大规模动态图数据集
runc hang 导致 Kubernetes 节点 NotReady
Annual comprehensive analysis of China's mobile reading market in 2022
eclipse链接数据库中测试SQL语句删除出现SQL语句语法错误
ArcGIS uses grid processing tools for image clipping
C#/VB. Net to add text / image watermarks to PDF documents
随机推荐
Building intelligent gray-scale data system from 0 to 1: Taking vivo game center as an example
实战:fabric 用户证书吊销操作流程
一个数据人对领域模型理解与深入
【AI系统前沿动态第40期】Hinton:我的深度学习生涯与研究心法;Google辟谣放弃TensorFlow;封神框架正式开源
Practice: fabric user certificate revocation operation process
诸神黄昏时代的对比学习
众昂矿业:为保障萤石足量供应,开源节流势在必行
Implementation mode and technical principle of MT4 cross platform merchandising system (API merchandising, EA merchandising, nj4x Merchandising)
After the game starts, you will be prompted to install HMS core. Click Cancel, and you will not be prompted to install HMS core again (initialization failure returns 907135003)
It is six orders of magnitude faster than the quantum chemical method. An adiabatic artificial neural network method based on adiabatic state can accelerate the simulation of dual nitrogen benzene der
PostgreSQL 9.1 飞升之路
模块化笔记软件综合评测:Craft、Notion、FlowUs
CVPR 2022 | TransFusion:用Transformer进行3D目标检测的激光雷达-相机融合
7、 Software package management
面向个性化需求的在线云数据库混合调优系统 | SIGMOD 2022入选论文解读
Rsyslog configuration and use tutorial
Reptile exercises (I)
Fundamentals of container technology
Transformer principle and code elaboration (tensorflow)
Deploy halo blog with pagoda