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

查看:48
本文介绍了使用 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天全站免登陆