Content Encoding Error / Cannot Decode Raw Data (Fix NSURLErrorDomain Error)

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

What is the cause of the "Content Encoding Error" or "Cannot Decode Raw Data: (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 encoding gzip 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 will be automatically understood and decoded, so that the file can be unpacked and listed to the end user. Valid on both a desktop and a mobile browser. If this does not happen and the data stream coming in gzip format cannot be opened, the "Content Encoding Error" / NSURLErrorDomain errors appear.

For those who use WordPress, the error most often occurs when wrongly configure WP Super Cache plugin. 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 where archiving is not done properly at the server level, and gzip compression is activated 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

The deactivation can be done only by the server administrator or by a script that will give you access to the file editing php.ini.

Will 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 server services and everything should be back 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. 

Content Encoding Error / Cannot Decode Raw Data (Fix NSURLErrorDomain Error)

About the author

Stealth

Passionate about everything that means gadget and IT, I am pleased to write on stealthsettings.com from 2006 and I love to discover new things about computers and macOS, Linux operating systems, Windows, iOS and Android.

Leave a Comment