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

Enable browser cache for thumbnails #1609

Closed
wants to merge 1 commit into from
Closed

Conversation

@stefaang
Copy link

stefaang commented Sep 3, 2019

As suggested in nextcloud/docker#848

@stefaang

This comment has been minimized.

Copy link
Author

stefaang commented Sep 4, 2019

I've been reading into cache control a bit.. I guess private is more appropriate here so prevent privacy leaks. I'll make the change when I've got some feedback here.

@rullzer

This comment has been minimized.

Copy link
Member

rullzer commented Sep 4, 2019

Which thumbnails do you mean here?
Because there should already be caching headers set on the previews you get back. If not then that is a bug.

@stefaang

This comment has been minimized.

Copy link
Author

stefaang commented Sep 4, 2019

With browser cache - page reload = 1.3s
nc-with-browser-cache
Without browser cache - page reload = 9s
nc-no-browser-cache

As said, only applies to instances running on low-end hardware.

To be completely honest: this is actually a lighttpd server, not nginx.
But it demonstrates the benefit of adding a bit of browser caching. My main intension is to open up the discussion and provide a guideline for home users.
I wouldn't actually use this on decent server hardware.

@stefaang

This comment has been minimized.

Copy link
Author

stefaang commented Sep 4, 2019

Ideally, the file browser uses browser cached icons when available on load, then updates them once any non-304 GETs come in.

# Optional: enable browser caching for thumbnails
# Makes page loads really snappy for low power servers
# but potentially slightly outdated
add_header Cache-Control "public, max-age=86400";

This comment has been minimized.

Copy link
@skjnldsv

skjnldsv Sep 4, 2019

Member

If it's optional, it should commented :)

@rullzer

This comment has been minimized.

Copy link
Member

rullzer commented Sep 4, 2019

Ideally, the file browser uses browser cached icons when available on load, then updates them once any non-304 GETs come in.

Again, which request. Because the 304 on the previews should only happen after a day. Else something else if fishy.

So which requests (url please) are you trying to speed up here.
Because on all 4 setups I have access to icons are properly cached.

@stefaang

This comment has been minimized.

Copy link
Author

stefaang commented Sep 4, 2019

So which requests (url please) are you trying to speed up here.

The preview urls.

Ah... I've changed my setup from lighttpd to nginx and it seems to resolve the problems.
No more need for this MR.

FYI, I'm working on an Entware (openwrt based) setup and there was only a guide for a lighttpd based installation that worked more or less out of the box. Unfortunately performance was lacking.

Thanks anyway for your time.

@stefaang stefaang closed this Sep 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.