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

PageController to write out Last-Modified response header #31

Open
jsuurd opened this issue Aug 10, 2016 · 4 comments
Open

PageController to write out Last-Modified response header #31

jsuurd opened this issue Aug 10, 2016 · 4 comments

Comments

@jsuurd
Copy link

jsuurd commented Aug 10, 2016

When a CDN is used in front of DXA, it would be helpful if the PageController could write out the Last-Modified response header with the last published timestamp as value to support content invalidation. For background see Akamai CCU API Concepts.

@rpannekoek
Copy link
Contributor

TSI-1943 (internal issue ID for tracking purposes)

@rpannekoek rpannekoek added this to the V1.7 milestone Oct 4, 2016
@rpannekoek
Copy link
Contributor

We have been looking into this Enhancement further (we were considering implementing it in DXA 1.7), but found it to be rather tricky:
Obtaining the Page's last publish date from Broker/DD4T and returning it as Last-Modified header is quite easy, but if the Page Model is dynamically modified (e.g. by XO Model Builder, by CX Dynamic Entity Evaluator or by ListController) or contains DCPs, using the underlying Page's last publish date may not be appropriate.

Closely related to the Last-Modified response header is processing of the If-Modified-Since request header. For this, we have to be especially careful with dynamic Pages: how do we reliably determine whether a rendered Page is modified if it contains dynamic data (which may be obtained from other systems) and even the Views may include dynamic data?

Suggestions how to deal with this?

@rpannekoek rpannekoek removed this from the V1.7 milestone Nov 1, 2016
@jsuurd
Copy link
Author

jsuurd commented Nov 3, 2016

This functionality would be used (in our case at least) in combination with a deployer extension that flushes the URL on page publish. In this use case using the publish date as Last-Modified header would be perfectly acceptable. Also pages with dynamic content should probably not be cached by the CDN to begin with :).

IMHO I think trying to determine a Last-Modified date depending on when dynamic content on a page changes would be sort of a theoretical discussion and sounds to me like over-engineering the solution. I would compare it to the lastmod time stamp of a page in the sitemap.xml; I don't think anyone generates those real time based on dynamic content on a page.

@rpannekoek
Copy link
Contributor

The question is whether it is useful to put a (potentially wrong) Last-Modified response header in, without processing If-Modified-Since request headers?
Typically, the Last-Modified response header is used to trigger a If-Modified-Since header on subsequent requests and the server can then send an HTTP 304 Not Modified response if the page wasn't modified since that date/time.
However, accurately determining whether a (potentially dynamic) Page is modified is not easy.

I agree that "pages with dynamic content should probably not be cached (by the CDN) to begin with". But how do we distinguish between "pages with dynamic content" and "pages with static content"? Isn't the whole idea behind Dynamic Delivery architectures like DXA that the majority of pages have (more or less) dynamic content?

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

No branches or pull requests

2 participants