Hide a client request header with a Nginx reverse proxy server

前端 未结 2 904
不思量自难忘°
不思量自难忘° 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: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.

提交回复
热议问题