Hi all,
I've came across challenging situation when using NGINX.
I have a nginx body filter when returning response to calling client which modifies sent JSON. I want to handle gracefully situation when that filter doesn't work correctly (i.e. throws an error) and I cannot return valid content. As far as I understand, is already to late to change Http header to 500 (Internal Server Error) or 204(no content) and in my current solution calling client receives 200/OK and empty body which is ugly.
Any ideas/trick I could do to change it somehow, preferably to return HTTP 204 or 500?
I thought about something like having additional location which would be exposed to client and handle that kind of scenario in it's content handler using capture() call to my current location, which in fact would be hidden but for some reason I find this solution not really clean and a little bit complicated.
Any other ideas?
Cheers,
Michał