React is configured across domains and nginx reverse proxy is used. Nginx does not forward requests.

Development environment:
Front-end react: localhost:3000
back-end restful api:192.168.33.3:8080

the browser can access the backend restful api: normally

clipboard.png

reactaxiosapi:


localhostnginx:


:
localhost:3000/api/articles:

clipboard.png

what is not configured correctly?

Mar.24,2022

what did you start your react with? If you don't cooperate with webpack, you need to use Nginx?.

The

port is occupied, can't you just let one of them change for another? For example, the service port for starting react is changed to 3001


Nginx is used as a web server, and when you start it with crate-react-app, or when webpack, is a web server using node, there is bound to be a conflict between the two. Agent, it is recommended that the proxy, of webpack-dev-server can be used by Baidu without the help of Nginx.


first of all, you should understand a problem: after the development of a vue or react project, for example, instead of leaving the code on the server, npm run start. You should first build, the code through npm run build, and then you will find that there is an extra build folder. The folder contains the code we need to put on the server. Drag this compressed folder to the server. If you use nginx, then you just need to configure the static file, and then the other configurations are the same as yours. Of course, you need to have a /.
after the / api configuration file. If you need to access server resources when developing locally, you just need to add:

to the package.json folder.
  

has the subject been solved? Mine is now the same question, whether it is configured to forward the request or to report to 404 Magi Postman, you can request

.
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-1e5b837-65c4d.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-1e5b837-65c4d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?