nginx log_format指令记录自定义响应头
我们用的nginx有做过一些定制开发,为了调试方便,加了一些自定义的response header,那么如何把这个自定义头记录到日志中以便于观察呢?
nginx log_format指令支持这种扩展,如下说明:
The headers, transmitted to client, begin from the prefix "sent_http_", for example, $sent_http_content_range. Note that variables produced by other modules can also be logged. For example you can log upstream response headers with the prefix "upstream_http_", see upstream .
wiki地址:http://wiki.nginx.org/HttpLogModule
举例:如果你自定义的响应header是My_Custom_Header,那么只需要在log_format中增加$sent_http_my_custom_header即可
PS:nginx对header的处理是大小写不敏感的。
nginx log_format指令记录自定义响应头的更多相关文章
- 浏览器获取自定义响应头response-headers
原创作品版权归属本人所有,违者必究 https://blog.csdn.net/qq_37025445/article/details/82888731想在浏览器获取响应头里面自定义的响应头:file ...
- nginx自定义log_format以及输出自定义http头
官方文档地址: http://nginx.org/en/docs/http/ngx_http_log_module.html 一.log_format默认格式 首先Nginx默认的log_format ...
- nginx反向代理proxy_set_header自定义header头无效
公司使用nginx作为负载均衡,有时候需要自定义header头发送给后端的真实服务器. 想过去应该是非常的简单的事情. 例子如下: 设置代理服务器ip头 1 proxy_set_header X- ...
- Nginx配置各种响应头防止XSS,点击劫持,frame恶意攻击
为什么要配置HTTP响应头? 不知道各位有没有被各类XSS攻击.点击劫持 (ClickJacking. frame 恶意引用等等方式骚扰过,百度联盟被封就有这些攻击的功劳在里面.为此一直都在搜寻相关防 ...
- nginx自定义模块记录上游服务器特定响应头
功能,服务器通过扩展自定义命令,记录上游的服务器返回的特定响应头内容,记录到本地文件中 代码如下: /* * Copyright (C) Ciaos */ #include <ngx_confi ...
- nginx 定义:响应头和请求头
1) 响应头 add_header 例如: add_header Cache-Control no-cache; add_header Access-Control-Allow-Origin *; a ...
- Nginx 操作响应头信息的实现
前置条件:需要编译 ngx_http_headers_module 模块,才支持 header 头信息操作 add_header 意思为将自定义的头信息的添加到响应头,指令为 add_header n ...
- nginx替换响应头(重点:如何在替换时加上if判断)
在实现微信小程序内嵌非业务域名时,通过nginx做镜像网站绕过小程序业务域名检测,但有一些表单页面提交后会返回一个302状态,由响应头Location的值决定提交成功后的跳转地址.那么问题来了,这个地 ...
- nginx 日志记录 自定义详解(分析上报用)
nginx 日志记录 自定义详解 1.log_format 普通格式 log_format main '$remote_addr - $remote_user [$time_local] $req ...
随机推荐
- 使用Yeoman搭建 AngularJS 应用 (12) —— 让我们搭建一个网页应用
原文地址:http://yeoman.io/codelab/local-storage.html 安装Bower程序包 我们使用另一个Angular模块,"angular-local-sto ...
- c++ 链接
header.h #ifndef HEADER_H #define HEADER_H unsigned long getFac(unsigned short num); ; #endif // HEA ...
- Navicat for mysql 远程连接 mySql数据库10061、1045错误问题 (转)
远程使用Navicat for mysql 客户端软件连接 mySql数据时,连接出现 2003-Can’t connect to MySQL on ’192.168.1.2’(10061)错误时,是 ...
- 在MAC下调试运行暗黑全世界客户端及部分代码注解(基于Firefly)
原地址:http://www.myexception.cn/program/1399860.html 在MAC下调试运行暗黑全世界客户端及部分代码注解(基于Firefly) 在MAC下调试运行暗黑世界 ...
- hdu 3864 D_num
思路:给一个数n,是否只有4个约数(包括1),也就是找3个大于1的约数. 而任何一个数都可由质数表示,所以对于给定的数,只需要进行质因数分解.这里有 2种情况:如果有3个一样的质因数,则满足条件:否则 ...
- 玩转redis
http://www.cnblogs.com/huangxincheng/p/5002794.html
- 创业公司Playcafe关门大吉 创始人总结10大失败教训
导读:互联网电视游戏网站PlayCafe的创始人马克·高登森(Mark Goldenson)日前撰文,总结了自己创业失败的十个教训.以下为文章主要内容: 一年半前,我与公司联合创始人戴维·奈格(Dev ...
- WPF之给使用了模板的MenuItem添加快捷操作
说在前面: WPF中给按钮或者是具备Command等元素实现快捷键其实是非常简单的,例子如下: <Button Content="_Test" Click="But ...
- 219. Contains Duplicate II
题目: Given an array of integers and an integer k, find out whether there are two distinct indices i a ...
- node.js模块值formidable
模块地址:https://github.com/felixge/node-formidable var formidable = require('formidable'), http = requi ...