Joomla Administrator Bad Gateway 502 on error

by vegetable   Last Updated July 11, 2016 08:04 AM

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:

Nginx 502 in Administrator

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

on nginx along with fastcgi_intercept_errors

and with 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)

Answers 1

Manage to solve it adding custon header on the error.php file on the administrator template... don't know if that's the best solution.

if ($this->error->getCode() >= 400 && $this->error->getCode() <= 500) {
    header("Status: {$this->error->getCode()}", true, $this->error->getCode());
} else {
    // Here is where MySQL Error would fit (e.g. mysql error 1064)
    header("Status: 500", true, 500);
July 11, 2016 07:05 AM

Related Questions

Nginx infinite redirect loop with multilingual Joomla

Updated December 13, 2017 18:10 PM

Allow access to users administration

Updated July 03, 2017 11:10 AM

how to use mod_rewrite in joomla backend

Updated March 12, 2017 15:10 PM

You must provide at least one recipient email address

Updated January 27, 2017 14:04 PM