Content encoding Error / Cannot Decode Raw Date (Fix Error NSURLErrordomain)

"Content encoding Error"Or"Cannot Decode Raw Data”Is the same error, the message being different from one internet browser to another. This error can occur when trying to access a Web page from your calculator or your mobile phone.
users Safari, I also receive an error code in the continuation of the message: NSURLErrorDomain - 1015. This means that the problem cannot be solved by the page visitor, but by administratorthe website on which this error is present.

What is the cause of the “Content Encoding Error” or “Cannot Decode Raw Date: (NSURLErrordomain)

Web servers, whether we're talking about Apache or Nginx, I use a archiving / compressing and coding (encoding) gzip of web pages, to serve the data flow in smaller packages to users. For example, if a web page has a normal size of 512KB, with gzip encoding this can be reduced to up to 150KB. Automatically the traffic for the host server as well as for the end user will be lower with gzip encoding, and the upload speed will be higher.
This gzip content must contain some coordinates that can be understood and decoded automatically, so that the file can be unpacked and listed to the end user. Valid on both a browser desktop as well as for a mobile one. If this does not happen and the data stream in gzip format cannot be opened, “Content Encoding” errors occur. Error”/ NSURLErrorDomain.

For those who use WordPress, the error occurs most often when configure the plugin incorrectly WP Super Cache. In the settings “Advanced”Of the module, there is a recommended option, which compresses web pages to be served faster to users. "Compress pages so they're served more quickly to visitors. (Recommended) ".

disabling of this option and deleting all cached web pages it can be a solution.

There is also the scenario in which archiving is not done correctly at the server level, and gzip compression is enabled directly from PHP. In this scenario, you will need to disable compression directly from the PHP configuration file. Zlib Output Compression.

How we disable it “Zlib Output Compression” on a web server

Deactivation can only be done by administratorserver or through a script that will give you access to edit the file php.ini.

It will be set "off" for "zlib.output_compression"In php.ini.

; Valid values for this option are 'off', 'on', or a specific buffer size
; to be used for compression (default is 4KB)
; Note: Resulting chunk size may vary due to nature of compression. PHP
;   outputs chunks that are few hundreds bytes each as a result of
;   compression. If you prefer a larger chunk size for better
;   performance, enable output_buffering in addition.
; Note: You need to use zlib.output_handler instead of the standard
;   output_handler, or otherwise the output will be corrupted.
; http://php.net/zlib.output-compression
zlib.output_compression = off

After this change is made, restart the web services of the server and everything should return to normal.

Also do not use "Zlib Output Compression” la nivel de server daca aveti si un plugin care face deja acest lucru. Modulul va memora in cache o pagina web deja comprimata, iar la utilizatorul final rezultatul va fi o eroare de decodare a paginii web. 

Passionate about technology, I enjoy writing on StealthSettings.com since 2006. I have a rich experience in operating systems: macOS, Windows, and Linux, as well as in programming languages and blogging platforms (WordPress) and for online stores (WooCommerce, Magento, PrestaShop).

How to » Linux » Apache » Content encoding Error / Cannot Decode Raw Date (Fix Error NSURLErrordomain)
Leave a Comment