Skip to content

adding cache control headers for css and js - fixes #11496 - #11556

Merged
butonic merged 1 commit into
masterfrom
cache-js-and-css
Oct 14, 2014
Merged

butonic merged 1 commit into
masterfrom
cache-js-and-css

Conversation

@DeepDiver1975

Copy link
Copy Markdown
Contributor

@scrutinizer-notifier

Copy link
Copy Markdown

The inspection completed: No new issues

@butonic

butonic commented Oct 14, 2014

Copy link
Copy Markdown
Contributor

instead of the .htaccess we should tell php to send correct cache control headers:

session_cache_limiter('public');
session_cache_expire(120); // minutes = 2h
session_start();

we could also check the php configuration and tell the admin to fix it by setting
http://php.net/manual/de/session.configuration.php#ini.session.cache-limiter
http://php.net/manual/de/session.configuration.php#ini.session.cache-expire

also see http://php.net/manual/de/function.session-cache-limiter.php
note that the default of nocache produces Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 which confuses IE

@LukasReschke

Copy link
Copy Markdown
Contributor

@butonic We cannot do this here to my understanding because those files are static and therefore not served via PHP.

@butonic

butonic commented Oct 14, 2014

Copy link
Copy Markdown
Contributor

🤦 just ignore the noise ... still the default of nocache confuses IE and makes the gallery behave weird. just set it to session_cache_limiter(''); to disable automatic sending of CC headers by PHP.

@LukasReschke

Copy link
Copy Markdown
Contributor

LGTM 👍

@butonic

butonic commented Oct 14, 2014

Copy link
Copy Markdown
Contributor

👍

butonic added a commit that referenced this pull request Oct 14, 2014
adding cache control headers for css and js - fixes #11496
@butonic
butonic merged commit 766314a into master Oct 14, 2014
@butonic
butonic deleted the cache-js-and-css branch October 14, 2014 08:41
@ghost

ghost commented Oct 14, 2014

Copy link
Copy Markdown

💣 Test FAILed. 💣
Refer to this link for build results (access rights to CI server needed):
https://ci.owncloud.org//job/pull-request-analyser-ng-simple/23/
💣 Test FAILed. 💣

@LukasReschke

Copy link
Copy Markdown
Contributor

@owncloud-bot Rtest this please.

@butonic

butonic commented Oct 14, 2014

Copy link
Copy Markdown
Contributor

@owncloud-bot retest this please.

@MorrisJobke

Copy link
Copy Markdown
Contributor

@DeepDiver1975 What about a backport?

@LukasReschke

Copy link
Copy Markdown
Contributor

Please not. This has the chance to break external third-party apps. Ok for master for me because we can fix the link generation there, but we shouldn't break stable7.

@MorrisJobke

Copy link
Copy Markdown
Contributor

Okay.

@josh4trunks

Copy link
Copy Markdown
Contributor

any reason this is 2 hours instead of longer? Just wondering.

@karlitschek

Copy link
Copy Markdown
Contributor

I´m not sure I completely understand this. Currently the css and js files are linked including a ?hash which should have the effect that the browser doesn´t cache it. Which is a feature not a bug because the browser has to load a new version once a new instance, core version or version on any app changed.
Not sure what exactly this patch changes here.

@LukasReschke

Copy link
Copy Markdown
Contributor

@karlitschek This instructs the browser and intermediate proxies (i.e. load balancers) to cache the resource. - This is handy because not every webserver is configured properly out there.

If the hash changes then the caching will be invalidated. However, since we do currently not include the app version within the hash we cannot easily backport this in case somebody uses a third-party app. However, this is something that we can easily fix in the future.

@LukasReschke

Copy link
Copy Markdown
Contributor

#11374 - according issue.

@karlitschek

Copy link
Copy Markdown
Contributor

@LukasReschke Thanks. We should add the app version indeed. Otherwise we definitely trigger bugs.

@lock lock Bot locked as resolved and limited conversation to collaborators Aug 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants