Vue Nginx reverse proxy configuration to solve cross-domain production environment

After a good local agent Vue editor, can achieve cross-domain data acquisition interfaces, but after being given 404 packaged in a production environment interface, how can we solve the production cross-domain problem?
After the local agent development environment configured using Nginx reverse proxy cross-domain environment to solve production problems!

1, modify Nginx configuration file xxx.conf

LOCATION / {API 
   . /?(.*)$ the rewrite API + ^ / $. 1 BREAK; // optional parameter, verify the regular address 
   include uwsgi_params; // optional parameter to uwsgi communication protocol server and server applications, It specifies how to forward the request to the application and return 
   proxy_pass https://www.xxxxx.cn:444; # here revised to address their requests, the required 
} 
### API for the local development, in config / index .js in proxyTable: {} configure request Broker 
### modified depending on the circumstances

  2, remember to restart Nginx service, the changes to take effect

Guess you like

Origin www.cnblogs.com/zhaohongcheng/p/11250161.html