【发布时间】:2020-09-20 21:52:31
【问题描述】:
我试图从我自己的 FS 中模拟网站。我想拦截任何 http 请求并将其重定向到我的服务器,该服务器将返回所需的文件。 我写了一个简单的默认服务器:
server {
listen <<SERVICE_PORT>> default_server;
server_name _;
location / {
proxy_set_header X-ORIGINAL-URI $request_uri;
proxy_set_header X-ORIGINAL-REFERRER $http_referer;
proxy_set_header X-ORIGINAL-HOST $http_host;
proxy_pass <<BROWSE_RESOURCE_URL>>/browsing/resource/;
proxy_redirect off;
}
}
当输入“http://exapmle.com”这样的网址时,它可以正常工作。但是当任何路径添加为“http://exapmle.com/bar”时,它不会传递到 >/browsing/resource/。目前我收到 404 但不是来自我的服务器。
offcurce 我根本不需要将原始 uri 连接到我的 proxy_pass。
为什么它对我有用?
【问题讨论】:
标签: nginx reverse-proxy proxypass