Problem/Motivation

simple_sitemap has a notion of the last modified time for each sitemap. It'd be handy if this value appeared as an HTTP header in the response for a sitemap. This can be useful for monitoring, debugging, validation, etc.

This is also related to #3090254: Cached sitemap since if we're going to make sitemap responses cacheable, we'll want to know when each one was actually modified so that caching systems can know when to refresh, etc.

Proposed resolution

When crafting the response for a sitemap, include the last modified date as an HTTP header.

Remaining tasks

  1. Make the change.
  2. Update test coverage accordingly.
  3. Reviews / refinements / improvements.
  4. RTBC.
  5. Commit.

User interface changes

None.

API changes

None.

Data model changes

None.

Comments

dww created an issue. See original summary.

dww’s picture

I looked into this for a bit today. Alas, the internal APIs I'd use to write this properly are either commented out or insufficient for my needs. Seems like it'd be a bigger patch than I was hoping for, at least in the short term. Plus, I'm guessing you're not going to want to set this header on its own, without addressing the bigger questions at #3090254: Cached sitemap.

So, for now, I went with a custom event subscriber for the site where I need this. It notices if we're on a sitemap page and sets the Last-Modified header directly.

That said, if the maintainers are interested in supporting this upstream, please let me know and I'd be happy to try to work on a real patch here.

Thanks,
-Derek

gbyte’s picture

Thanks for your input. Feel free to contribute a patch after #3090254: Cached sitemap has been pushed (where you are contributing already).

This is also related to #3090254: Cached sitemap since if we're going to make sitemap responses cacheable, we'll want to know when each one was actually modified so that caching systems can know when to refresh, etc.

This sounds to me like the response headers are necessary or important for the caching process? If that's the case, maybe set this issue as child issue or merge both?

dww’s picture

Title: Set the Last-Modified HTTP response header for sitemaps » [PP-1] Set the Last-Modified HTTP response header for sitemaps
Status: Active » Postponed
Parent issue: » #3090254: Cached sitemap
Related issues: -#3090254: Cached sitemap

Thanks for the reply. Yes, Last-Modified is important for caching. We should either add it directly as part of #3090254: Cached sitemap, or after that's complete. For now, setting this one to postponed. If we don't sort this out as part of #3090254, we can unpostpone this and handle it then. If we add it there, we can move this to "Works as designed". ;)

Cheers,
-Derek

gbyte’s picture

Version: 8.x-3.x-dev » 4.x-dev

  • walkingdexter committed 00467341 on 4.x
    Issue #3199996 by dww, gbyte, walkingdexter: Set the Last-Modified HTTP...
walkingdexter’s picture

Status: Postponed » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.