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

Proposal: Add Cache-Control header during file creation #4878

Open
thangngoc89 opened this issue May 7, 2024 · 0 comments
Open

Proposal: Add Cache-Control header during file creation #4878

thangngoc89 opened this issue May 7, 2024 · 0 comments

Comments

@thangngoc89
Copy link

I'm serving large files directly from Cloudflare R2 by redirecting to pre-signed link for CDN benefits. See discussion.
However, with S3 or any S3 clones, you need to set Cache-Control header during file upload or modify afterwards. The current default is no caching.

Since the Serve function always add caching

setHeaderIfMissing(res, "Cache-Control", "max-age=2592000, stale-while-revalidate=86400")

I would like to propose that Cache-Control should be added during writing to the file system.

I'm quite new to Golang but I've done some digging:

CacheControl is a field of WriterOptions and Pocketbase is currently calling this in 4 locations.

I could imagine a PR would involve adding this field to all of the 4 locations and fixing any failed test. If this is the case, I'm happy to send a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant