Download & Extend

Dependency on mod_headers

Project:Boost
Version:5.x-1.x-dev
Component:Apache integration
Category:task
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

In the boost module's .htaccess file there is:

# Rewrite rules for static page caching provided by the Boost module:
  # BOOST START
  <IfModule mod_headers.c>
    Header add Expires "Sun, 19 Nov 1978 05:00:00 GMT"
    Header add Cache-Control "no-store, no-cache, must-revalidate, post-check=0, pre-check=0"
  </IfModule>

mod_headers is not a part of Apache core. However in the INSTALL.txt there is not a mention of the dependency on mod_headers. I've seen the case where if mod_headers is not available, boost works, but with some particular issues, such as stale caches when switching between logged in and logged out.

I'll commit a little documentation about the need for mod_headers if that sounds reasonable. I'll change the INSTALL.txt from:

Since the static page caching is implemented with mod_rewrite directives,
Apache version 1.3 or 2.x with mod_rewrite enabled is required (if Drupal's
clean URLs work for you, you're fine; if not, get them working first).
Other web servers, such as Lighttpd, are NOT supported at present.

I can add to the 5.x and 6.x versions if that sounds good/makes sense.

to:

Since the static page caching is implemented with mod_rewrite and mod_headers
directives, Apache version 1.3 or 2.x with mod_rewrite and mod_headers enabled
is required.  If your clean URL's are working on your site, then you are all set with
mod_rewrite.  Checking for mod_headers can be trickier.  If you enable Boost and
have the Boost .htaccess file in place, you can use a tool like Firebug to check that
the main request for the boosted website has "Response headers" like:
"Cache-Control max-age=1, no-store, no-cache, must-revalidate, post-check=0,
pre-check=0".  Other web servers, such as Lighttpd, are NOT supported at present.

Comments

#1

Not just README, there should be a hook_requirements() that checks for this. I think http://us2.php.net/manual/en/function.apache-get-modules.php does the job.

#2

Status:active» needs review

Good call Moshe. I've attached a patch for review with the documentation and the hook_requirements implementation. I was going to just do the requirements for the 'install' phase but then thought of situations where a site gets migrated from one server to another (which will happen often for sites moved from Development to Production) where one server may have mod_headers enabled and the new server may not. Then, in order to make the error message intuitive on the modules page, it was necessary to add an additional condition and manipulate the array because of the hard coded "Currently using..." message output by core.

AttachmentSize
boost_mod_headers.patch 3.21 KB

#3

Is there a rationale for using this in the first place? Assigning these fields tells the visitor's browser that all content needs to always be re-loaded, nothing could be cached, even images, JS, or anything else. Please explain why this would be in the best interest of our visitors?

#4

@DamienMcKenna: I'm also curious about this. I think we can learn some stuff from D7 core atm: #147310: Implement better cache headers for reverse proxies

#5

Status:needs review» needs work

some hosts (php 5.25 godaddy) do no implement apache_get_modules(). Should make sure function_exits() before calling it.

#6

Updated per mikeytown2's request.

AttachmentSize
boost_mod_headers_v2.patch 3.37 KB

#7

Version:5.x-1.0» 6.x-1.x-dev
Component:Documentation» Apache integration
Assigned to:Ian Ward» Anonymous
Status:needs work» patch (to be ported)

I should definitely look into checking for the correct apache modules for 6.x. apache_get_modules() is the key and the above patch uses it.

#8

Status:patch (to be ported)» needs review
AttachmentSize
boost-339571.patch 2.54 KB

#9

Version:6.x-1.x-dev» 5.x-1.x-dev

committed; moving this back to 5.x

#10

Status:needs review» closed (fixed)

Closing all 5.x issues; will only reevaluate if someone steps up #454652: Looking for a co-maintainer - 5.x

Reason is 6.x has 10x as many users as 5.x; also last 5.x dev was over a year ago. The 5.x issue queue needs to go.

nobody click here