Hide a client request header with a Nginx reverse proxy server

前端 未结 2 903
不思量自难忘°
不思量自难忘° 2020-12-10 11:27

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

proxy_hide_header hides the server response headers and can\'t

相关标签:
2条回答
  • 2020-12-10 12:02

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

    proxy_set_header       Sec-WebSocket-Extensions "";
    
    0 讨论(0)
  • 2020-12-10 12:05

    The official documentation explains the correct way to remove a client request header:

    If the value of a header field is an empty string then this field will not be passed to a proxied server:

    proxy_set_header Accept-Encoding "";
    

    In case that wasn't clear, this is more than just a workaround to mask the value; the entire header will be dropped.

    0 讨论(0)
提交回复
热议问题