2

I want to implement If-Modified-Since HTTP header in my drupal site. How do I ensure the If-Modified-Since HTTP header is supported and that it is active?. If it is supported but not active then how to make it active?

3
  • Correction: This header is set in user agent. Drupal only responds to it. Your title is a bit misleading now - or i misunderstood your intentions.
    – Mołot
    Aug 7 '14 at 14:57
  • After googling I came to see If Modified Since Tool feedthebot.com/tools/if-modified to check if my web page supports the if modified since http header you can use this tool: After checking this tool says: This webpage does not support the if modified since http header. So my basic question is how to make my page support if modified since http header. My question may not be drupal specific but a worth knowing for me Aug 8 '14 at 5:08
  • Please use edit button. And have you enabled caching at all?
    – Mołot
    Aug 8 '14 at 6:12
2

As you can see in drupal_serve_page_from_cache function, Drupal knows and uses this headers. Exact quote is:

If the request is conditional (using If-Modified-Since and If-None-Match), and the conditions match those currently in the cache, a 304 Not Modified response is sent.

How can you test? Obviously you can forge HTTP request in your user agent and see. Or you can believe in built-in tests.

Of course if you will not turn any cache on, there is no reason to react to If-Modified-Since, because you have no cached data to serve if content is not modified. Default cache is located under http://example.com/admin/config/development/performance, and you can use other cache modules and mechanisms, too. Then, it's up to them to react to cache-related headers properly.

4
  • Yes I have already implemented boost cache. can it be possible that my boost is not configured properly Aug 8 '14 at 6:54
  • 1
    @MdEqbalAhmad yes, it can - but that looks like a material for a follow-up question. Usually Boost asks you to disable regular cache - by doing it you also disable core response to If-Modified-Since and If-None-Match.
    – Mołot
    Aug 8 '14 at 6:56
  • molot@ If Modified Since header requires web server support. I mean is there any web server related issue should also be looked after Aug 8 '14 at 7:03
  • 1
    @MdEqbalAhmad You're simplifying it, but basically yes. So? What does it have to do with my answer? Drupal responds to them properly, if your webserver does not hide such headers from it, and webserver configuration is pretty much off-topic here anyway. Webserver software usually don't hide headers from web applications, not by default.
    – Mołot
    Aug 8 '14 at 7:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.