nginx 反向代理背后的 ASP.NET customErrors
我有一个 ASP.NET 服务器在计算机上的端口 8080 上运行,出于性能原因,nginx 缓存反向代理在端口 80 上运行。请求发送到端口 80,然后,如果 nginx 缓存没有应答,则会传递到本地主机:8080 通过 nginx proxy_pass 指令。
到目前为止,除了 ASP.NET 自定义错误之外,此设置运行良好。我希望它们是“RemoteOnly”,但由于反向代理,所有请求都将源自本地主机,因此是本地的。我确实通过 nginx 传递了 X-Real-IP 和 X-Forwarded-For,但 ASP.NET 似乎完全忽略了这一点。有什么想法吗?
I have a ASP.NET Server running on port 8080 on a machine, and for performance reasons an nginx caching reverse proxy running on port 80. Requests are done to port 80 and then, if not answered by the nginx cache, are passed to localhost:8080 via nginx proxy_pass directive.
This setup works fine so far, except for the ASP.NET customErrors. I'd like them to be "RemoteOnly", but due to the reverse proxy ALL requests will be originating from localhost and thus be local. I do pass the X-Real-IP and X-Forwarded-For via nginx, but ASP.NET seems to completely ignore this. Any idea?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看来,当发生从 8080 到 80 端口的重定向时,对于 IIS 来说,这听起来像是本地请求。 (IIS 对 ngix 一无所知)。因此在这种情况下永远不会发生“远程请求”。
It seems, when redirect from 8080 to 80 port occures, for IIS it sounds like local request. (IIS doesn't know about ngix anything). Therefore "remote request" will never occur in this case.