使用Nginx反向代理服务器隐藏客户端请求标头 [英] Hide a client request header with a Nginx reverse proxy server

查看:747
本文介绍了使用Nginx反向代理服务器隐藏客户端请求标头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Nginx websocket反向代理,我想从客户端请求中隐藏一个HTTP标头.

I have a Nginx websocket reverse proxy and I would like to hide a HTTP header from the client request.

proxy_hide_header隐藏服务器响应标头,不能用于隐藏客户端请求标头.

proxy_hide_header hides the server response headers and can't be used for hiding client request headers.

我想这样做是因为nginx后面的websocket服务器不能与websocket扩展名"permessage-deflate"配合使用,因此我想从客户端请求中删除Sec-WebSocket-Extensions标头.

I would like to do that because the websocket server behind nginx doesn't work well with the websocket extension "permessage-deflate" so I would like to remove the Sec-WebSocket-Extensions header from client requests.

推荐答案

您可以将标头值设置为void,Nginx会将其删除:

You can set a header value to void and Nginx will drop it :

proxy_set_header       Sec-WebSocket-Extensions "";

这篇关于使用Nginx反向代理服务器隐藏客户端请求标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆