Is it possible to configure Nginx Ingress to return 204 on a given path?
In Nginx, it would look like this:
location / { return 204; }
Thank you!
Is it possible to configure Nginx Ingress to return 204 on a given path?
In Nginx, it would look like this:
location / { return 204; }
Thank you!
There is a way to do this in AWS scenarios mentioned here: https://kubernetes-sigs.github.io/aws-load-balancer-controller/v2.2/guide/ingress/annotations/#actions
nginx supports some annotations like nginx.org/location-snippets
(https://docs.nginx.com/nginx-ingress-controller/configuration/ingress-resources/advanced-configuration-with-annotations/#snippets-and-custom-templates), which might allow you to pass in an nginx location in the way you describe above.
But I don't know if there is a generic way.
This is what I did:
metadata:
annotations:
nginx.ingress.kubernetes.io/server-snippet: |
location /ping {
return 204;
}
More information here: https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/#server-snippet