我一直在遵循https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/中的nginx文档来为我的OData请求设置反向代理,但是由于我不断收到404错误,所以我一定做错了。
我的nginx.conf看起来像这样:
location / {
root /Users/me/Sites;
index index.html index.htm;
autoindex on;
}
location /sap/opu/odata {
proxy_pass http://server_machine:XXXX/sap/opu/odata;
proxy_set_header Authorization "Basic myEncodedPassword";
}
我想念什么吗?
答案 0 :(得分:0)
此配置对我有用:
server {
charset UTF-8;
listen XXXX;
root /html;
index index.html;
server_name YYYYY;
location /resources {
alias "C:\\XXXXX";
}
location / {
alias "C:\\XXXXX";
}
location /sap {
proxy_pass http://XXX.XX.XX.XXX/sap;
proxy_set_header Accept-Encoding "";
proxy_set_header X-Forwarded-Proto https;
}
location ~ /\. {
deny all;
}
}