In the development of calling api once, www.abc.com needs to call the api in api.www.abc.com to complete the file upload.
After the interface is written, there is a cross-domain problem, and the normal request cannot be completed.
The browser returns:
Request Method :OPTIONS
Later, I thought that nginx has a location proxy_pass, which can handle my problem:
Modify the nginx configuration as follows:
server {
listen 80;
server_name www.abc.com;
location / {
proxy_pass http://192.168.1.1:8080;
}
location /upload_api/ {
proxy_pass http://192.168.1.33:8080/;
}
}
Configure a subdomain to point to the original api.www.abc.com address to handle cross-domain issues.
www.abc.com/upload_api/
Although the cross-domain problem is dealt with, the domain name url address is changed. This is not a surefire way.