Front and back separation cross-domain problem

during the deployment phase of the project, the front-end call interface is cross-domain. Should you set a reverse proxy on the web server or add cross-domain code on the server? which is better, or is there a better way?

Jun.10,2021

server settings allow cross-domain. Now most of them do this, which is more convenient for


server. Originally, the performance bottleneck is the server, and then you add a proxy to become the minimum value of the server and your own proxy service (and even make many back-end functions useless), just for cross-domain.


Cross-domain is allowed, of course. Simple and convenient.

you can also make them support JSONP

. If

doesn't work, be an agent. As a matter of fact, it's troublesome to play this thing well.


this is not a complete simple solution, but needs to be balanced in many aspects.
if the api provided by the server is stateless and the security requirements are not high, it is best to set the server to run across domains.


personally, there are many ways to solve project cross-domain problems simply. The use of proxy service in the project is not to solve cross-domain problems, such as load balancing, etc., which can be used to kill both cattle and chickens. I think it's a similar reason

Menu