nginx 更改代理的引用

maw*_*wie 6 nginx proxy

我在 nginx 中设置了一个非常基本的代理规则。但是,代理请求的资源会进行引用检查。它必须与运行服务的域相同。因此,我需要更改引用者。我尝试了 proxy_set_header 但这似乎不起作用。

我错过了什么还是有其他方法可以做到这一点?

location /api/v1/ {
    proxy_pass http://192.168.10.10:8080;
    proxy_set_header Referer "http://192.168.10.10";
}
Run Code Online (Sandbox Code Playgroud)

小智 4

您说代理服务器要求域名作为引用者。尝试使用该域名而不是 IP 地址。

proxy_set_header Referer "http://proxied-domain-here.com";
Run Code Online (Sandbox Code Playgroud)