版权声明:在那最初的相遇中,我们都曾经为彼此心动过... https://blog.csdn.net/weixin_36185028/article/details/83860157
在nginx.conf中配置
server {
location / {
index index.html index.htm index.php l.php;
add_header 'Access-Control-Allow-Origin' '*';
autoindex off;
}
location /apis {
#http://192.168.1.80:19963为访问另一台服务器的接口域名地址
rewrite ^.+apis/?(.*)$ /$1 break;
include uwsgi_params;
proxy_pass http://192.168.1.80:19963;
}
}
前端请求:
$.ajax({
type:"post",
dataType: "json",
data:{title:title,content:cont},
url:"/apis/ipfs/hedgeChain/AddBlock",
success:function(res){
}
,error:function (e) {
}
});
浏览器显示请求地址:
实际请求地址: