nginx:
location /api { proxy_pass http://api.xxx.cn/; add_header Content-Type "application/json;charset=utf-8"; add_header 'Access-Control-Allow-Origin' '*'; add_header 'Access-Control-Allow-Credentials' 'true'; add_header 'Access-Control-Allow-Methods' 'GET, POST'; }
apche:
<IfModule mod_proxy.c> ProxyRequests Off SSLProxyEngine on ProxyPass /api https://api.xxx.cn/ ProxyPassReverse /api https://api.xxx.cn/ </IfModule>
或者 直接使用 宝塔的反向代理:
本文为Jsky原创文章,转载无需和我联系,但请注明来自Jsky博客 www.tjin.link