作者热门文章
- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我有一个 nginx/nodejs 堆栈。
我的 nginx 配置为在我的 nodejs 进程关闭时提供静态 502 错误页面。
现在,我想让我的nodejs正常运行,偶尔向nginx抛出一个502,以在某些用户请求时触发静态502页面。我该怎么做?
我试图在我的 Node 进程中抛出一些错误而不捕获它们,但这导致错误堆栈被直接传递到客户端浏览器。
最佳答案
将此添加到您的代理配置中:
proxy_intercept_errors on;
根据 the manual :
Determines whether proxied responses with codes greater than or equal to 300 should be passed to a client or be redirected to nginx for processing with the error_page directive. Default off
关于node.js - 如何将 502 抛给 nginx?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34621729/
我是一名优秀的程序员,十分优秀!