nginx 反向代理背后的 ASP.NET customErrors

标签 asp.net error-handling nginx reverse-proxy

我有一台机器上的 8080 端口上运行的 ASP.NET 服务器,出于性能原因,一个 nginx 缓存反向代理在端口 80 上运行。请求会发送到端口 80,然后,如果 nginx 缓存没有响应,则将其传递给 localhost :8080 通过 nginx proxy_pass 指令。

到目前为止,此设置运行良好,除了 ASP.NET customErrors。我希望它们是“RemoteOnly”,但由于反向代理,所有请求都将来自本地主机,因此是本地的。我确实通过 nginx 传递了 X-Real-IP 和 X-Forwarded-For,但 ASP.NET 似乎完全忽略了这一点。任何的想法?

最佳答案

看来,当发生从 8080 到 80 端口的重定向时,对于 IIS 来说,这听起来像是本地请求。 (IIS 对 nginx 一无所知)。因此在这种情况下永远不会发生“远程请求”。

关于nginx 反向代理背后的 ASP.NET customErrors,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8770663/

相关文章:

asp.net - Visual Studio : Convert 'Empty ASP.NET' template into MVC

javascript - 使用 JavaScript/Jquery 关闭 .aspx

php - 更改PHP记录语法错误的位置

ruby-on-rails - (使用 phusion passenger + Nginx)运行具有相同端口(80)的多个实例名称的相同 Rails 应用程序

asp.net - OpenID Connect : Proper way of authenticating user - ID token or Access token? 刷新 ID token ?

javascript - MongoDB查找是否存在不按预期方式工作

ios - 在我创建的文件上运行打开时出现错误 13(权限被拒绝)(iOS)

django - http 403 错误 + "readv() failed (104: Connection reset by peer) while reading upstream"

django - 如何配置 nginx 以将 mp4 视频正确提供给 Safari?

c# - 如何从 ASP.NET 注销 siteminder session