configure-nginx-how-to-handle-500-error-on-upstream-itself-while-nginx-handle 自定义header 传递header 定义拦截器
应用程序拦截
nginx 拦截 保证 接口返回
proxy_intercept_errors
http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_intercept_errors
server {
listen 8003 default_server;
set $rip $remote_addr;
set $x_request_trace_dump_this trace-id-host@$host-pid@$pid-connection@$connection-bytes_sent@$bytes_sent-msec@$msec-remote_addr@$rip;
proxy_temp_file_write_size 102400k;
location @fallback {
return 500 '{"status":500,"data":[],"msg":"please call admin..."}';
}
location / {
proxy_intercept_errors on;
error_page 500 502 503 504 = @fallback;
gzip on;
gzip_proxied any;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Request-Trace-Dump $trace;
if ($http_x_request_trace_dump = '') {
set $x_request_trace_dump_that '';
}
set $x_request_trace_dump_that $http_x_request_trace_dump;
set $trace $x_request_trace_dump_that@@$x_request_trace_dump_this;
proxy_pass http://127.0.0.1:8004/;
}
}
configure-nginx-how-to-handle-500-error-on-upstream-itself-while-nginx-handle 自定义header 传递header 定义拦截器的更多相关文章
- nginx停止后再启动出现: [error] open() "/usr/local/nginx/logs/nginx.pid" failed错误的解决方法
为了备份数据 手动停止了服务器的nginx 结果启动时报错 nginx: [error] open() "/usr/local/nginx/logs/nginx.pid" fail ...
- f-stack中nginx配置后make出现error: ignoring return value of ‘ftruncate’
问题 Nginx 配置后 make 出现error: src/os/unix/ngx_process_cycle.c: In function 'ngx_start_worker_processes' ...
- 【yii2从Apache迁移到nginx上访问报500错误】
[yii2从Apache迁移到nginx上访问报500错误] 今天迁移yii2项目从Apache到nginx,出现了几个小问题,记录一下 index.php 加上 error_reporting(E_ ...
- nginx的报错500
500:服务器内部错误,也就是服务器遇到意外情况,而无法履行请求. 500错误一般有几种情况: 1. web脚本错误,如php语法错误,lua语法错误等. 2. 访问量大的时候,由于系统资源限制,而不 ...
- 记一次接口调试错误: {"timestamp":"2019-09-11T03:04:30.036+0000","status":500,"error":"Internal Server Error","message":"Could not write JSON: Object is null; nested exception is com.fasterxml.jackson
接口测试中用postman测试返回是正常的,但是使用其他人去调用就出错了,找了半天,才想起来使用了nginx,用于端口的代理转发.然后根据错误信息发现json格式的某个字段为null,结合日志中的报文 ...
- Nginx nginx: [emerg] using regex "\.php$" requires PCRE library 或 编译nginx错误:make[1]: *** [/pcre//Makefile] Error 127
nginx: [emerg] using regex "\.php$" requires PCRE library 或 编译nginx错误:make[1]: *** [/pcre ...
- HTTP Status 500 - Error instantiating servlet class cn.it.bd.S011
HTTP Status 500 - Error instantiating servlet class cn.it.bd.S011 出现此报错的很大可能是因为 <servlet-class> ...
- servlet程序HTTP Status 500 - Error instantiating servlet class 解决
在eclipase 中编译 servlet 但是一致报 HTTP Status 500 - Error instantiating servlet class XXX类 的问题 , 解决方法 1. ...
- 转载:configure执行流程(1.5.2)《深入理解Nginx》(陶辉)
原文:https://book.2cto.com/201304/19619.html 我们看到configure命令支持非常多的参数,读者可能会好奇它在执行时到底做了哪些事情,本节将通过解析confi ...
- tomcat已启动,使用maven的deploy发布后,根据路径打开浏览器访问时报错HTTP Status 500 - Error instantiating servlet class
web项目中请求出现错误,如下: HTTP Status 500 - Error instantiating servlet class XXXX类 type Exception report mes ...
随机推荐
- WampServer详解
php能做什么,它是运行在服务器端的,web网站大部分数据都是存储在服务器上的,PHP就是用来处理这些存储在服务器的数据.跨平台,服务器可以是多种平台上的服务器,脚本语言,免费. wampserver ...
- systemd_journal_no_entries问题解决
问题: #journalctl Journal file /var/log/journal/410/system@0.journal~ uses an unsupported feature, ign ...
- tengine编译安装及nginx高并发内核参数优化
Tengine Tengine介绍 Tengine是由淘宝网发起的Web服务器项目.它在Nginx的基础上,针对大访问量网站的需求,添加了很多高级功能和特性. Tengine的性能和稳定性已经在大型的 ...
- 2013.5.2 - KDD第十四天
今天早上来了之后就处理语料,然后发现处理好后的gbk编码的语料在HPC上没法训,而utf8在上面训练可以.后来就让它在上面训着,学长还没来. 学长回来之后问他怎么回事,他说不应该,然后我们看了一下第一 ...
- js HTTP 下载 处理 api 请求 返回数据流
axios({ method: 'post', url: 'url....', data:{}, timeout: 1000*60, responseType: 'blob',// 此选项必须设置 否 ...
- 虚拟机安装Linux从零到登陆成功教学
1.Linux Linux使我们出来windows以外可能接触最多的操作系统了,因为好多超级大的互联网公司,比如阿里等就是用Linux的,所以我们最起码要知道怎样去使用,使用的前提就是我们要有一个这样 ...
- Django示例演示--?
引用自:https://blog.csdn.net/weixin_42950386/article/details/83143293 定义模型类 模型类被定义在"应用/models.py&q ...
- Flume组件
1.什么是Flume:apache顶级项目,主要用来做数据采集.分布式.高可用,将海量日志进行采集.聚合.传输的系统.能够对数据进行简单处理在发送到接收方. 2.Flume组件:source.chan ...
- sublime+python3 中文环境
工具-编译系统-新编译系统 { "cmd": ["C:/Program Files (x86)/Python36-32/python.exe","-u ...
- php 数组的计算
数组是我们最常用到的类型,那如何计算某个一维数组的个数呢.其实我们可以用到我们之前学过的数学函数里面的一个:count(). 我们来看看count函数的用法: int count ( mixed $变 ...