-
Notifications
You must be signed in to change notification settings - Fork 26
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
Template modification date determines value of Last-Modified header #471
Comments
Hi @jwadolowski , you may configure what headers are returned by Knot.x Server instance and what are not by overriding
The default behavior you suggested:
looks good to me. It could quite nice improvement. Let us know it that helped. |
Thanks @Skejven.
Workaround I used was implemented directly at CDN level. Regarding re-setting
In general there's probably no universal solution. |
@jwadolowski , there might be a solution that Knot.x can technically support. It is a bit simplified scenario in comparison to your proposition:
As you wrote, this is not universal solution. It is custom behaviour, not everyone might want to use it. In my opinion this is good candidate for |
Bug description
I recently discovered that knot.x copies
Last-Modified
header it receives from template repository and sends it back to the HTTP client. Such behavior can cause caching issues, especially when rather static templates are combined with dynamic data and the response goes through shared cache (CDN, forward proxy server, etc).knot.x version:
1.4.0
Steps to reproduce
I captured 2 scenarios that outline the problem.
1st example
Cache-Control: private
) and contains the sameLast-Modified
header knot.x got from template repositoryIf-Modified-Since
header (to be honest I have no idea why Chrome decided to send such request, perhapsLast-Modified
presence was enough andCache-Control: private
doesn't have any meaning in this context)Last-Modified
header. At the same time it remembered that the request hadIf-Modified-Since
header. Simple date comparison takes place and it turns out that nothing has changed, so CDN thinks it's ok to reply with 304 to save some bandwidth (304 doesn't have the body)2nd example
Cache-Control
,Surrogate-Control
,Edge-Control
or any other header that tells CDN how long it can keep it in the cacheLast-Modified
header value and sends GET withIf-Modified-Since: <date_from_last_modified_header>
. knot.x does its magic and returnsLast-Modified
it got from the template call.Expected behavior
My first thought was that knot.x should do one of the following things:
Last-Modified
it gets from template repositoryLast-Modified
if Handlebars markup got evaluated and placeholders were filled in with dynamic dataLast-Modified
header completelyAfter a bit of thinking I realized that in some cases
Last-Modified
header presence could be needed (i.e. template that renders single object off of some identifier that doesn't change often). At the same time re-using whatever came from template repository is definitely not expected.As a rule of thumb I'd say that whenever knot.x injects data into Handlebars template it should remove
Last-Modified
header and possibly re-set its value. Ideally the 2nd part should be somehow configurable.Screenshots
N/A
Additional context
N/A
The text was updated successfully, but these errors were encountered: