Resolve the cross-domain problem when the local HTTP system accesses HTTPS interfaces:

Background: The front-end system uses the Nginx proxy. The front-end access address is http://127.0.0.1/xxx and the third party is https://xxx.cn.

1. Configure the nginx proxy on the server as shown in the following figure:

server { listen 80; Server_name 127.0.0.1; Alias F:/XXXX/XXX; index index.html index.htm; } # location/API {proxy_pass https://xxx.cn/; }}Copy the code

2. Set the IP address of the third-party access interface in the project as follows:

/ API/XXX XXX indicates the interface and parameter parts of the proxy addressCopy the code

The preceding two steps solve the cross-domain problem of HTTP accessing HTTPS.