Aman Pant
Aman Pant

Reputation: 11

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.

Response image

Upvotes: 1

Views: 1153

Answers (1)

Yogesh_D
Yogesh_D

Reputation: 18809

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.

Upvotes: 1

Related Questions