How to return 204 with Nginx Ingress K8S

gf flag

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!

tr flag

There is a way to do this in AWS scenarios mentioned here:

nginx supports some annotations like (, 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.

Francois Coulloudon avatar
gf flag
Thank you! You put me on the right way, in fact I had to add annotation on "server-snippet".
gf flag

This is what I did:

  annotations: |
      location /ping {
        return 204;

More information here:

And here:

I sit in a Tesla and translated this thread with Ai:


Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.