-
Notifications
You must be signed in to change notification settings - Fork 138
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
Caching #480
Caching #480
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👀
Codecov Report
@@ Coverage Diff @@
## master #480 +/- ##
==========================================
- Coverage 27.13% 26.82% -0.32%
==========================================
Files 64 64
Lines 7337 7423 +86
==========================================
Hits 1991 1991
- Misses 5346 5432 +86 |
build.rs
Outdated
@@ -1,8 +1,39 @@ | |||
extern crate plume_common; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should probably remove it from Cargo.toml
too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I totally forgot about that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
impl<'r> Responder<'r> for Ructe { | ||
fn respond_to(self, r: &Request) -> response::Result<'r> { | ||
//if method is not Get or page contain a form, no caching | ||
if r.method() != Method::Get || self.0.windows(6).any(|w| w == b"<form ") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably obvious, but why do we disable caching on pages with a form?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the page contain a form, the csrf token will be cached, and may no longer match user's cookies. As these tokens are added later by a fairing, there is no way to detect the page changed here. The other solution could be to allow caching of page and for rocket_csrf to remove ETag when appropriate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Thanks!
Try to cache static resources.
Static non media file's timestamps are hashed at compile tome so that modifying them invalidate old cache.
For some reason, plume-front.wasm isn't loaded from cache, even if it contains the right headers.I changed nothing and now it is? I guess I'm ok with it
I'll look into adding Etag support tooAll response made from templates and not containing a form are now Etag-cached