Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache-Control: no-transform redundant w/ TLS? #185

Closed
Malvoz opened this issue Mar 25, 2019 · 12 comments · Fixed by #191
Closed

Cache-Control: no-transform redundant w/ TLS? #185

Malvoz opened this issue Mar 25, 2019 · 12 comments · Fixed by #191
Labels
enhancement New feature or request help wanted Extra attention is needed
Milestone

Comments

@Malvoz
Copy link
Contributor

Malvoz commented Mar 25, 2019

Is cache-control: no-transform redundant over HTTPS?

Better to focus on https which cannot be modified in flight [...]

https://meta.discourse.org/t/add-cache-control-no-transform-http-header/25152/3

Some mobile providers will compress or alter content, in particular images, to save bandwidth when re-transmitting content over cellular networks. This could break digital signatures in some cases. "no-transform" will prevent that (but again: doesn't matter for SSL [...]

https://isc.sans.edu/forums/diary/The+Security+Impact+of+HTTP+Caching+Headers/17033/

As suggested by some folks in their articles, "payload transformations" aren't possible over HTTPS. This sounds logical, but I am unsuccessful in confirming this.

In https://tools.ietf.org/html/rfc7234#section-5.2.1.6 I'm unable to traverse up to find information on payload transformation in relation to the HTTP/HTTPS protocol.


If it is the case that no-transform is redundant over HTTPS, then this:

Header merge Cache-Control "no-transform"

Could be (or only/and with a note stating no need to use if HTTPS?):

Header merge Cache-Control "no-transform" "expr=%{HTTPS} != 'on'"
@LeoColomb LeoColomb added the enhancement New feature or request label Mar 25, 2019
@LeoColomb
Copy link
Member

LeoColomb commented Mar 25, 2019

Good catch.
Actually, does the no-transform still useful?

(Also: https://csswizardry.com/2019/03/cache-control-for-civilians/#no-transform)

@Malvoz
Copy link
Contributor Author

Malvoz commented Mar 25, 2019

(Also: https://csswizardry.com/2019/03/cache-control-for-civilians/#no-transform)

If you’re running over HTTPS—which you should be—then intermediaries and proxies can’t modify payloads anyway, so no-transform would be ineffective.

Everyone seems to agree with that statement!

If it is still useful? H5BP doesn't default to TLS configs (which is debatable), but today more than not - developers use TLS for their websites. Which renders no-transform useless as we've established in our extensive reasearch. :)

@LeoColomb
Copy link
Member

LeoColomb commented Mar 25, 2019

H5BP doesn't default to TLS configs

I plan to, while working on #1. I did it already for nginx configs. But we can't enable them by default since it require certificates we don't have.

our extensive reasearch

😎


@XhmikosR Thoughts?

@LeoColomb
Copy link
Member

Side note: if we keep it, the rfc link needs to be updated to https://tools.ietf.org/html/rfc7234#section-5.2.1.6

@XhmikosR
Copy link
Member

I don't have an opinion myself since I only use HTTPS in all my projects.

@LeoColomb
Copy link
Member

Same for me. I think we can consider dropping it.

@LeoColomb LeoColomb added the help wanted Extra attention is needed label Mar 26, 2019
@LeoColomb LeoColomb mentioned this issue May 6, 2019
5 tasks
@LeoColomb LeoColomb added this to the v4.0.0 milestone May 6, 2019
@LeoColomb LeoColomb added the good first issue Good for newcomers label May 15, 2019
@LeoColomb LeoColomb changed the title cache-control: no-transform redundant w/ TLS? Cache-Control: no-transform redundant w/ TLS? May 15, 2019
LeoColomb added a commit to h5bp/server-configs-nginx that referenced this issue May 15, 2019
@markwoon
Copy link

While I'm not advocating reverting this change, I wanted to point out that Google's Lite Mode (previously known as Data Saver) does work on https, and does respect no-transform.

Reference: https://venturebeat.com/2019/04/23/google-kills-chrome-data-saver-extension/

@Malvoz
Copy link
Contributor Author

Malvoz commented May 21, 2019

Thanks for the information @markwoon.

The IETF RFC 7230, section 5.7.2 on transformations refers to proxies only, and the articles I listed to initially all refers to "proxies cannot modify payloads over HTTPS". However, in comment 8 in https://bugs.chromium.org/p/chromium/issues/detail?id=941948#c8 clarifies: For HTTPS pages, a Lite page does NOT use a proxy. which further suggests Google's Lite Mode is indeed able to transform payloads, even over HTTPS.

This certainly favors keeping https://github.com/h5bp/server-configs-apache/blob/master/src/web_performance/content_transformation.conf as is. Currently, the snippet applies to all content, while the Google Bot only looks for cache-control: no-transform in text/html for opt-outs. I don't think it's necessary to change anything since that's "just" Google.

From what I've read, these transformations may apply to any website really. Not only slow websites, but rather wether the user is on a slow client or not. If you have a Google account, you can use the Transcoder test tool or visit googleweblight.com with your url in the u query string parameter, such as https://googleweblight.com/i?u=https://www.html5boilerplate.com to test the effects of such transformations.

Useful articles:
https://support.google.com/webmasters/answer/6211428?hl=en
https://blog.chromium.org/2019/04/data-saver-is-now-lite-mode.html
https://blog.chromium.org/2019/03/chrome-lite-pages-for-faster-leaner.html
https://source.android.com/devices/tech/connect/data-saver
Older article (before name change from Data Saver to Lite Mode, probably shares many of the heuristics): https://developer.chrome.com/multidevice/data-compression

@LeoColomb
Copy link
Member

Thanks for these extensive review guys!

Although I personally am not in favor of using these kind of weird tools, I don't feel confortable advocating against data savers & co usage.
I mean they are build for something useful and can be very relevant in some countries/situations, are we sure we should promote bypassing these technology?

The scenario is very different from the original arguments focusing advertisements or trackers addition.

@LeoColomb LeoColomb reopened this May 21, 2019
@LeoColomb LeoColomb removed the good first issue Good for newcomers label May 21, 2019
@markwoon
Copy link

I'm going to abstain from what the default should be. I'm on slow connections often enough to know how painful that can be, but I also hate debugging caching problems.

I do vote for this getting documented.

People should decide for themselves how they want their site to behave.

@Malvoz
Copy link
Contributor Author

Malvoz commented May 21, 2019

@LeoColomb

I don't feel confortable advocating against data savers

While I agree that data saving is important (in fact I proposed a CSS media query allowing developers to serve lighter content based on that preference) I think developers should be wary of the fact that their content may be modified unless having opted out from it, since these transformations may disable scripts, styles and even form submissions.

are we sure we should promote bypassing these technology?

No not promoting it, but more so what @markwoon said. Until yesterday I had no idea my content was subject to transcoding.

But I agree, in most cases content transformation (certainly under Google's Web Light heuristics, e.g.: user is on a 2G connection, Google Bot finds the page will take more than 5 seconds to load) will be useful and developers should be careful opting-out.

@LeoColomb
Copy link
Member

developers should be wary

👍

developers should be careful opting-out

That's my main concern. 😉
But let's keep it for now, indeed.

LeoColomb pushed a commit that referenced this issue Jun 5, 2019
…#191)

* Update link to RFC, add mentions of Lite Mode

Changes motivated by #185

* Refactor desc., highlight caution for disabling

I added that we're using `cache-control: no-transform` in the introductory paragraph because that is what we link to below that paragraph. Can remove if redundant, but added for clarity.

Also, IMO we should still separate the warnings "(!)" about considering the impact of disabling content transformations and "If you are using `mod_pagespeed`" because the majority of developers probably aren't using `mod_pagespeed` and so if you aren't using it, it's simple to distinguish.
LeoColomb added a commit to h5bp/server-configs-nginx that referenced this issue Jun 5, 2019
LeoColomb added a commit to h5bp/server-configs-test that referenced this issue Jul 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants