@Krischell Villadulid Thanks for reaching out to Microsoft Q&A, apologize for any inconvenience caused on this.
Based on the shared information, I have understood that you are trying to eliminate the Server header from the app service response and also, I assume that your application is running on Linux app service Plan.
If yes, you can follow the below set of instructions on remove/eliminate the server
header.
- SSH your web app through
https://SITE-NAME-HERE.scm.azurewebsites.net/webssh
- Copy the existing
nginx.conf
file withcp /etc/nginx/nginx.conf /home/site
- Modify the
ngixn.conf
file with using editor likenano /home/site/nginx.conf
orvi /home/site/nginx.conf
- Uncomment
server_tokens off
under http section also add thismore_clear_headers 'Server';
and save the file.
- Create a startup script in any location inside home directory, example: /home/site/startup.sh with the following content:
#!/bin/bash
apt-get update && apt-get install -y nginx-extras
cp /home/site/nginx.conf /etc/nginx/nginx.conf
service nginx reload
Update Startup Command
using Azure Portal from Configuration
-> General Settings
with the startup script location /home/site/startup.sh
Or using Azure CLI:
az webapp config set --resource-group <resource-group-name> --name <app-name> --startup-file "/home/site/startup.sh"
I have tested this in my local environment it is working fine, and I would suggest you validate from your end as well.
Feel free to reach back to me if you have any further questions on this.