Remove the "Server" Response Header present in nginx app response
search cancel

Remove the "Server" Response Header present in nginx app response

book

Article ID: 297494

calendar_today

Updated On:

Products

VMware Tanzu Application Service for VMs

Issue/Introduction

App uses nginx buildpack where the Server response header is present. Users need to completely remove the Server response from the response header. 
28e813c0-97ba-47f0-8eb6-7a7b6d1cd7f9.png


Resolution

Usually setting more_clear_headers will clear the Server header. However the more_clear_headers do not come with standard nginx. It needs a 3rd party module to be compiled into nginx as the documentation shows here. If you want to use more_clear_headers with the NGINX buildpack, you can use openresty instead of the standard nginx distribution which is provided in the buildpack. To do so, simply have a buildpack.yml file as follows. 

---
dist: openresty


If you want to use it with standard nginx, you should be able to compile the module into an .so file manually, and then follow the instructions here for the buildpack to pick it up (i.e. add it to the modules directory in the app & reference it in the config).
Please make sure the module is built against the version of nginx you want to use & on the same platform as the stack. Here’s a documentation from nginx on building the module .so. We believe you need to use the --add-dynamic-module flag with configure, before running make modules.