Gunicorn Update HTTP Headers on Azure App Service

less than 1 minute read | By Arjun Baliga

Please refer to the steps below on how to update Gunicorn HTTP headers as a Security best practice.
Check the document below on exhaustive list of settings for Gunicorn.
Some settings are only able to be set from a configuration file. https://docs.gunicorn.org/en/latest/settings.html

  1. In the application root directory, create a file config.py with the server configurations.
    import gunicorn
    gunicorn.SERVER ="undisclosed"
    

    Gunicron Config code

  2. In the Azure portal, within the Configurations tab, add the below start-up command. Restart the App Service.
    gunicorn -c config.py –bind=0.0.0.0 –timeout 600 app:app

    Gunicorn start up command

  3. Verify that the HTTP header changes are reflected via the Browser Developer Tools.

    Gunicorn Hide Server Name