Hello Pranjali D. Deshbhratar,
Welcome to the Microsoft Q&A and thank you for posting your questions here.
I understand that you would like to hide a Response Server Header from a python application deployed in AKS as service.
You have several options to hide or remove the Server header in your response while running a Python Flask application on Azure Kubernetes Service (AKS), and since application-specific changes are not working, you can address this at the Kubernetes level using a few different methods as follows:
- Use an Ingress Controller: https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration and read more specifically on
ConfigMap
section related to customizing NGINX settings, andmore_set_headers
https://nginx.org/en/docs/http/ngx_http_headers_module.html - Use a Sidecar Proxy: https://www.nginx.com/resources/wiki/start/topics/examples/sidecar and https://kubernetes.io/docs/concepts/storage/volumes
- Use a Service Mesh: https://istio.io/latest/docs/reference/config/networking/virtual-service/ and https://linkerd.io/docs/latest/service-profiles
- Use a Custom HTTP Middleware: https://doc.traefik.io/traefik/middlewares/headers/#custom-response-headers
Those links provide more details and steps in some cases.
I hope this is helpful! Do not hesitate to let me know if you have any other questions.
** Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful ** so that others in the community facing similar issues can easily find the solution.
Best Regards,
Sina Salam