I'm migrating my Joomla! application from a NGinx (cache) + Apache (php) server to a Nginx + PHP-FPM Fast CGI one. When testing the different parts of it, I found that when the backend (administrator) threw an error (i.e. Could not write that file and so on) Nginx responded with a 502 Bad Gateway error.
I've seen this question:
But the solution there was to fix the problem causing the error rather than solving the Bad Gateway problem.
I've been trying to locate the real problem and reached to PHP responding with this as status header:
Status "0 Could not write file"
I think that Nginx is trying to map that header to a HTTP status code and then failing.
Does anyone have any idea on how to solve this?
I've seen error_page directive
nginx.org/en/docs/http/ngx_http_core_module.html#error_page
on nginx along with fastcgi_intercept_errors
nginx.org/en/docs/http/ngx_http_fastcgi_module.html#fastcgi_intercept_errors
and with proxy_intercept_errors
nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_intercept_errors
, but as the header is wrong I think I can't handle it on Nginx (also seems to control only status codes over 300)