当前位置:网站首页>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
边栏推荐
- 0703 interface automation - MySQL database connection, encapsulation, adding database verification in use cases
- CV pre training model set
- Sword finger offer II 091 Paint the house
- [paper notes] poly yolo: higher speed, more precise detection and instance segmentation for yolov3
- Afterword of Parl intensive learning 7-day punch in camp
- Differences and solutions of redis cache avalanche, cache penetration and cache breakdown
- Why is it said that restarting can solve 90% of the problems
- Asynchronous processing of error prone points
- appium服务的启动与关闭踩坑记录
- Agent and classloader
猜你喜欢

Paddlepaddle paper reproduction course biggan learning experience

合宙Air32F103CBT6开发板上手报告

剑指 Offer 09. 用两个栈实现队列

Sword finger offer 07 Rebuild binary tree

Data preprocessing - normalization and standardization

Pytorch distributed test pit summary

Postman usage notes, interface framework notes

双目3D感知(一):双目初步认识
![[paper notes] rethinking and improving relative position encoding for vision transformer](/img/6b/8b1c192e0ce715789465fa9ccaabfc.jpg)
[paper notes] rethinking and improving relative position encoding for vision transformer

Architecture evolution of high-performance servers -- Suggestions
随机推荐
Principle and implementation of MySQL master-slave replication (docker Implementation)
合宙Air32F103CBT6开发板上手报告
[paper notes] rethinking and improving relative position encoding for vision transformer
Distributed transaction solution
[paper notes] overview of case segmentation
Binocular 3D perception (I): preliminary understanding of binocular
Is it safe to open a stock account through the account opening link given by the account manager? I want to open an account
Distributed token
How to debug grpc by postman
Sword finger offer 07 Rebuild binary tree
Open the box to experience rust, come on!!!
Source code analysis of nine routing strategies for distributed task scheduling platform XXL job
VectorDraw Developer Framework 10.1001 Crack
基于深度Q学习的雅达利打砖块游戏博弈
[paper notes] street view change detection with deconvolutional networks
Several common optimization methods
Leetcode122 timing of buying and selling stocks II
Markdown learning
解决Visio和office365安装兼容问题
Install Kali extension 1: (kali resolution problem)