简体   繁体   中英

Elastic Beanstalk - Remove Nginx version from headers

I am using Elastic Beanstalk for hosting my node app. In my node response I got a header that shows the Nginx version. For security reasons I want to remove or overwrite it.

I don't want to change anything else. I just want to remove this header only.

I also tried to send header from backend side but Nginx overwrites this header.

响应图像

You will need to configure the nginx to turn server headers off. The way to configure the nginx.conf file for Elastic Beanstalk is described here - https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/java-se-nginx.html

And you need to set server_tokens off; in the nginx configuration. Detail of this config can be found at http://nginx.org/en/docs/http/ngx_http_core_module.html#server_tokens

Syntax: server_tokens on | off | build | string; Default:

server_tokens on;

Context: http, server, location

Enables or disables emitting nginx version on error pages and in the “Server” response header field.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM