I am trying to remove the server header (server: nginx/1.20.0
) from elastic beanstalk response. I have added 00_server.conf
to .platform/nginx/conf.d/
in the source bundle with the following configuration
server {
server_tokens off;
}
I am expecting this would extend the Elastic Beanstalk default nginx configuration as mentioned here and at least remove the version from the server header. But this is not working.
I need help with the following things:
- How do I extend the default configuration so that I can remove the server version?
- How do I remove the complete header?
I have looked at the similar questions on stackoverflow but they don't seem to help.
Update:
Issue 1 is resolved. server_tokens
need to be inside the http context. Updating the above configuration to
server_tokens off;
fixed the problem.