Err_content_decoding_failed

kevinjansen

Verified User
Joined
Sep 9, 2006
Messages
8
Dear Forum Users,

I have a clean install of DirectAdmin and a clean install of Joomla (latest version), everything works fine, but when i change the website into maintenance mode (offline) instead of a nice "underconstruction message" i get the following error:

Safari:
"cannot decode raw data" (NSURLErrorDomain:-1015)
Chrome:
ERR_CONTENT_DECODING_FAILED

When i change "gzip" to disabled, the site is showing 503:
Service Unavailable
The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.

This is/was working on the old hoster, the website it self is running fine, only the maintenance mode is not working.

Server Details:
Debian 9 / Also tested it on Debian 8
php-fpm72 and tested with php-fpm56
nginx_apache and tested with apache

zlib.output_compression = Off (tested it with On)
zlib.output_compression_level = -1 (tested it with 5)

I think it has to do something with the gzip, but i am not sure if have turned it on/off on all different versions but without succes.
Searched the Joomla forums, and they all say "turn off gzip" but then u get the 503 ugly error, instead of the website with a message that its currently offline.
 

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
13,889
Location
GMT +7.00
Hello,

The 503 error is probably not related to gzip at all. With disabled gzip you can see the error which might already exist but is not observed with gzip on.

So you'd better check apache error logs of the domain for possible clues.
 

ditto

Verified User
Joined
Apr 27, 2009
Messages
2,464
This is a bug in the 4 virtual_host2*.conf files for the PHP1 version. The PHP2 version have "ProxyErrorOverride on" commented out, but the PHP1 version does not. It has been fixed in the next DirectAdmin version, and also the fix is available in pre-release binaries.

If you want to fix it manually until the next version is released, you do this: Edit the following 4 files at the path: /usr/local/directadmin/data/templates/

virtual_host2.conf
virtual_host2_secure.conf
virtual_host2_secure_sub.conf
virtual_host2_sub.conf

Change ProxyErrorOverride on to be commented out like this:

#ProxyErrorOverride on

You need to change this for "if HAVE_PHP1_FPM" in each of the above files. Then you do ./build apache to apply the changes.
 
Last edited:

ditto

Verified User
Joined
Apr 27, 2009
Messages
2,464
It only fix the 503 error, I have not seen "ERR_CONTENT_DECODING_FAILED" on my servers, so I can't say for sure if it fix that also. But I think it is very likely the problem kevinjansen post about is fixed by commenting out ProxyErrorOverride on
 

kevinjansen

Verified User
Joined
Sep 9, 2006
Messages
8
Dear ditto,

Thanks, that was indeed what the issue is/was.
The log files are empty btw and was not showing this.
 

Peter Laws

Verified User
Joined
Sep 13, 2008
Messages
1,747
Location
London UK
We still need to sort out the 404's, instead of displaying 'File not found' (unprofessional).....

ProxyErrorOverride on fixes this but generates further problems
 

ditto

Verified User
Joined
Apr 27, 2009
Messages
2,464
@Per Laws, This should be done/fixed in your PHP script. For example this is not a problem when running WordPress, 404 not found will be generated by WordPress. You just have to do the same for your custum PHP script.
 

Peter Laws

Verified User
Joined
Sep 13, 2008
Messages
1,747
Location
London UK
Not everyone uses s****y wordpress et al though (me included).....

So, how is this done when not using wordpress et al?

When you go to example.com/noneexistantpage.php it is the server's responsibility to give the right error
 
Last edited:

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
13,889
Location
GMT +7.00
Customize apache templates and update the block to the following view:

Code:
|*if HAVE_PHP1_FPM="1"|
                <FilesMatch "\.(inc|php|phtml|phps|php|PHP1_RELEASE|)$">
[B]                        <If "-f %{REQUEST_FILENAME}">[/B]
                                AddHandler "proxy:unix:/usr/local/php|PHP1_RELEASE|/sockets/|USER|.sock|fcgi://localhost" .inc .php .phtml .php|PHP1_RELEASE|
[B]                        </If>[/B]
                </FilesMatch>
|*endif|

source: https://wiki.apache.org/httpd/PHP-FPM
 

Peter Laws

Verified User
Joined
Sep 13, 2008
Messages
1,747
Location
London UK
Would this be considered a "fix"? I mean, as default for DA, so everyone is happy, or will this still interfere with CMS/etc scripts?
 

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
13,889
Location
GMT +7.00
That's up to John whether or not they will add it into DirectAdmin's templates for virtual hosts of Apache.

The funny thing is that DirectAdmin's templates for virtual hosts of Nginx have this check:

Code:
                        if (-f $request_filename)
                        {
                                fastcgi_pass unix:/usr/local/php|PHP2_RELEASE|/sockets/|USER|.sock;
                        }
you can find it in /usr/local/directadmin/data/templates/nginx_php.conf. The file is used on server with standalone Nginx.

The same idea but formed in a little bit another way can be found on Nginx's official site: https://www.nginx.com/resources/wiki/start/topics/examples/phpfcgi/#connecting-nginx-to-php-fpm

I guess you see the similarity of the configs for Apache and Nginx from my posts, don't you?

I believe they would not publish this solution on Apache's and Nginx's official sites if it wasn't working.

I don't know for sure why DirectAdmin developers did not add it into the templates yet. If I recollect it correct they changed several times the way Apache is connected to PHP-FPM, and probably this moment was left outside of their attention.

So, yes, I'd expect it to be working for all known and popular PHP applications, it does not interfere with mod_rewrite rules.

So, let's ask John to consider it being added for the next DA release.
 

ditto

Verified User
Joined
Apr 27, 2009
Messages
2,464
@zEitEr, I am not sure what you are reffering to. However I like to point out that DirectAdmin Support has removed "ProxyErrorOverride on" from the Apache templates, because it breaks Drupal and WordPress handling of Maintainance pages, and likely it also breaks many other CMS handling of Maintainance pages. So all I ask is that DirectAdmin support do not add back "ProxyErrorOverride on".
 

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
13,889
Location
GMT +7.00
I'm referring to the <If "-f %{REQUEST_FILENAME}"></If> construction for Apache mentioned by me in the post #10 as a reply to #9

The post #12 explains why I would expect this construction to be working and addresses Peter's doubts mentioned in the post #11.
 
Top