Why is the request for a website packaged by react+webpack not cross-domain?

Project is built with create-react-app scaffolding, simple project, no change to webpack configuration, front and rear separation.
Why is there no cross-domain problem when the project is packaged with npm run build and deployed to the server? When the
website is deployed to the server, what forwarding service is enabled by default, like nginx?

Apr.24,2021

confirm that the foreground server and the api server are different domain names?

if not, is the foreground server the nodejs server?

if so, check to see if you are using http-proxy.

it is most likely that there is no cross-domain or api configured with cors


the concept of cross-domain is similar to the case of a.com range b.com (of course, protocols, different ports are also cross-domain). When you are in the development environment, it is usually a local ip, such as 10.20.30.40 ip, 8080 index.hml, and at this time your api corresponds to the address of the online (or test environment), such as build.com, is obviously cross-domain. When you deploy the project online, when you access the front-end static resources, be sure to use build.com/index.html, 's interface to build.com at this time, not cross-domain.

is very simple, mainly aimed at the doubts of beginners on the road, do not spray useless words


there are no more than the following two situations.

1. Nginx or Nodejs on the server forwards your request
2. You write the format of absolute path ( http://xxxx) in the local request code, and then the backend interface enables cross-domain cros,. The request will be requested twice, the first time options type

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea4197-1cad.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea4197-1cad.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?