Skip to content

Occasional problem of corrupted html#19525

Merged
HLeithner merged 2 commits intojoomla:stagingfrom
demis-palma:accept-encoding
Sep 17, 2019
Merged

Occasional problem of corrupted html#19525
HLeithner merged 2 commits intojoomla:stagingfrom
demis-palma:accept-encoding

Conversation

@demis-palma
Copy link
Contributor

@demis-palma demis-palma commented Feb 2, 2018

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 joomla-framework/application#79

@ggppdk
Copy link
Contributor

ggppdk commented Feb 2, 2018

It is not only about older browser seeing corrupted HTML

There is 1 more reason to add this
and thus have proxies, etc store both compressed and uncompressed version

If an old browser (or some browser) is the first to request a content as uncompressed

then the proxy will cache only the uncompressed content
and it will serve it to browsers that can accept compressed content
thus having worst responce time

@ghost ghost added the J3 Issue label Apr 5, 2019
@ghost ghost removed the J3 Issue label Apr 19, 2019
@viocassel
Copy link
Contributor

I have tested this item ✅ successfully on a07e67d


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/19525.

1 similar comment
@SharkyKZ
Copy link
Contributor

I have tested this item ✅ successfully on a07e67d


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/19525.

@ghost
Copy link

ghost commented Aug 12, 2019

Status "Ready To Commit".

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Aug 12, 2019
@HLeithner
Copy link
Member

It took some time but thanks for adding this header to Joomla.

@HLeithner HLeithner merged commit 6c90418 into joomla:staging Sep 17, 2019
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Sep 17, 2019
@HLeithner HLeithner added this to the Joomla! 3.9.12 milestone Sep 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants