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 ...
随机推荐
- keil5工程移植到IAR工程
keil5工程移植到IAR工程 一. 软件版本 MDK-ARM Professional Version: 5.14.0.0 IAR 8.1 移植工程:基于正点原子开发板建立的STM32F407ZG ...
- springboot 使用常用注解
找到方法封装成json格式 @RestController = @Controller+@ResponseBody //一个组合注解,用于快捷配置启动类,springboot启动主入口 @Spring ...
- Linux命令——sync
参考:A Step-By-Step Guide to Using the Linux sync Command 前言 数据只有被读入内存才能被CPU所处理,但是数据又常常需要由内存写回磁盘当中(例如储 ...
- VMware安装ubantu
下载ubantu镜像文件: http://mirror.pnl.gov/releases/xenial/ http://mirrors.melbourne.co.uk/ubuntu-releases/ ...
- MyBatis_tp50_动态sql_sql标签_抽取可重用的sql片段_使用include标签进行引用
笔记要点出错分析与总结 include内部使用自定的属性,之能使用$ {}来取值 ,#{}不能用 工程组织数据库组织0.重新修改Bean类1.定义接口 public interface Employe ...
- 使用Restful风格中的post使用过遇到前端数据传送不到后端
问题描述:使用postman进行请求时候,前端的数据,一直在后端接收不到,找了好多资料,竟然是因为一个注解的原因. 后端接收设置:@RequestParam@ReqeustBody设置的原因 因为sp ...
- (三)WCF之契约
自从我们接收ITOO项目之后,就必须跟WCF打交道,既然必须直面WCF,我就对WCF进行了研究(还不是很深入,是自己目前的理解).之前对WCF的一些基础知识进行了简单的介绍,本篇重点来介绍WCF的契约 ...
- python 判断返回值是否是字典
背景: 小鱼最近再调一个小工程时,需要对返回值进行处理(返回值如下),有的返回值 有data1 有的没有:需要做个判断,判断是否含有该key值 返回值: res1 = {"result&qu ...
- K8s中的多容器Pod和Pod内容器间通信
容器(Container)常被用来解决比如微服务的单个问题,但在实际场景中,问题的解决往往需要多容器方案.本文会讨论将多个容器整合进单个Kubernetes Pod 中,以及Pod中的容器之间是如何通 ...
- Dubbo源码分析:Dubbo协议解码
Dubbo协议解码时序图