当前位置:网站首页>Popular cross domain
Popular cross domain
2022-06-25 15:41:00 【Bamboo shrimp】
Front end development front-end and back-end separation projects , You will often encounter cross domain (Cross-Origin) The problem of , Why is there a cross domain ? How to solve cross domain ? And what are the most common methods ?
what
The full name of cross domain is cross domain resource sharing
scene : When you request the interface address and the domain where the front-end file service is located ( Requested agreement ,ip And port ) At different times , You're going to report a mistake , Here's the picture 
why
The cross domain problem is actually caused by the same origin strategy of the browser , The same origin policy is the protection mechanism of the browser , Only web pages are allowed to request services under the same domain name .
The requirements of the same origin strategy are 3 Same as : agreement , The domain name and port should be consistent
how
【 Configure the backend 】CORS
Whether the browser enables the cross domain protection mechanism will respond according to the backend configuration , So the server needs to make a cross domain configuration
How to configure :
Modify the response header of the interface :Access-Control-Allow-Origin, The value is *,, If the browser passes the judgment, it will allow cross domain
【 Configure intermediate server 】 Reverse proxy
It means to use a proxy server to send requests on behalf of the real server
【 Configure intermediate server 】 Forward agency
This means that a proxy server is used to send requests on behalf of clients , Generally, the browser is used as the proxy server , This is directly in webpack It's equipped with
JSONP【 Not recommended 】
Actually by script The characteristics of the label ( No cross domain restrictions ) To achieve cross domain , Server side cooperation is also required , And can only use get Method , There are security risks , Not recommended
边栏推荐
- Super comprehensive custom deep copy function
- JVM memory region details
- Day01: learning notes
- Paddlepaddle paper reproduction course biggan learning experience
- golang使用mongo-driver操作——增(进阶)
- Sword finger offer 09 Implementing queues with two stacks
- Sword finger offer 04 Find in 2D array
- MySQL修改字段語句
- Differences and solutions of redis cache avalanche, cache penetration and cache breakdown
- Sword finger offer 10- I. Fibonacci sequence
猜你喜欢

Arthas source code learning-1

Learning to Measure Changes: Fully Convolutional Siamese Metric Networks for Scene Change Detection

中国高校首次!全球唯一!同济学子斩获国际大奖

Using R language in jupyter notebook

解决Visio和office365安装兼容问题

Highly concurrent optimized Lua + openresty+redis +mysql (multi-level cache implementation) + current limit +canal synchronization solution

基于深度Q学习的雅达利打砖块游戏博弈
![[paper notes] street view change detection with deconvolutional networks](/img/2d/777fd0d85ff4d349516b95923410fd.jpg)
[paper notes] street view change detection with deconvolutional networks

golang使用mongo-driver操作——增(进阶)

TFIDF与BM25
随机推荐
Statistical analysis - data level description of descriptive statistics
程序员 VS 黑客的思维 | 每日趣闻
剑指 Offer II 091. 粉刷房子
Is it safe to open an account for new bonds? What preparations are needed
Kali SSH Remote Login
The situation and suggestions of a software engineering associate graduate who failed in the postgraduate entrance examination
Distributed transaction solution
剑指 Offer 03. 数组中重复的数字
CPU over high diagnosis and troubleshooting
Talk about the creation process of JVM objects
golang reverse a slice
Weka download and installation
golang使用mongo-driver操作——增(进阶)
Mark the same items in the Li list in red
剑指 Offer 04. 二维数组中的查找
Sword finger offer II 091 Paint the house
Completabilefuture of asynchronous tools for concurrent programming
MySQL modifier l'instruction de champ
Highly concurrent optimized Lua + openresty+redis +mysql (multi-level cache implementation) + current limit +canal synchronization solution
Efficient pytorch: how to eliminate training bottlenecks