joomla-framework / application

Joomla Framework Application Package
GNU General Public License v2.0
21 stars 29 forks source link

Occasional problem of corrupted html #79

Closed demis-palma closed 6 years ago

demis-palma commented 6 years ago

When the compression of the response is delegated to Apache with mod_deflate, two headers are set during the compression:

Content-Encoding: gzip
Vary: Accept-Encoding

Vary: Accept-Encoding is important to prevent proxies, intermediate caches, or CDNs from serving compressed resource to clients that does not support compression and vice versa. "Vary: Accept-Encoding" header specifies that caches should only be used if the incoming request matches the "Accept-Encoding" information in the cache.

When the mod_deflate is disabled in the web server, and the compression is delegated to Joomla through Global Configuration → Server → Gzip Page Compression, in this case the header "Content-Encoding: gzip" is set, but "Vary: Accept-Encoding" no, which causes the problem mentioned above on modern networks.

Testing Instructions

Disable mod_deflate in your web server and enable Joomla compression Global Configuration → Server → Gzip Page Compression. Browse any page. Check that the response headers include Vary: Accept-Encoding in addition to Content-Encoding: gzip

Note

See https://github.com/joomla/joomla-cms/pull/19525

demis-palma commented 6 years ago

Should I submit the patch to the branch "2.0-dev" also?

mbabker commented 6 years ago

Should I submit the patch to the branch "2.0-dev" also?

No need. Similar to the CMS patches get merged up across supported branches (so here master is merged to 2.0 like staging is merged to 4.0).