Cached pages are created but not served

yngens - December 30, 2007 - 11:25
Project:Boost
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:norio
Status:patch (code needs review)
Description

hi, i have installed 5.x-1.x-dev version of the module of 2007-Dec-15. everything works fine, cached pages are created within /cache/www.mysite.com/0/ but when viewing the source of the page as an to anonymous user i don't see <!-- Page cached by Boost at 2006-11-24 15:06:31 --> as supposed in README.txt file of the module.

of course, i have replaced .htaccess with suggested by the module. what could be the reason?

#1

yngens - December 30, 2007 - 11:58

i have just found out that nevertheless i activated "Static page cache" option on /admin/settings/performance and set 1 hour as Minimum cache lifetime, it shows any submitted nodes on the first page immediately. or first page is not cached? anyway, none of other pages (not on the first page) does show <!-- Page cached by Boost at 2006-11-24 15:06:31 --> message in page source.

#2

christefanø - January 13, 2008 - 17:35

I saw this happen once, too. What I did was reset the Boost settings to the defaults (on the Site configuration -> Performance and Site configuration -> Performance -> Boost pages), disable Boost, re-enable and then reconfigure my Boost-related settings.

Please try this and change the issue to "fixed" if it works for you.

#3

greg@wisebread.com - January 21, 2008 - 07:06

Simply disabling and re-enabling the module didn't fix it for me.... but deleting the cache files as well did the trick.

#4

yngens - January 21, 2008 - 13:38

Thanks to all, finally got it working!

#5

christefanø - January 21, 2008 - 13:43

yngens, how did you solve this problem?

#6

yngens - January 21, 2008 - 14:06

as was suggested above disabled, deleted cache and re-enabled. of course, the most important part besides this is to properly install the module.

#7

czkuba - January 21, 2008 - 22:26
Version:5.x-1.x-dev» 5.x-1.0

Did what yngens suggested (disabled, deleted cache and re-enabled) but with no effect, the pages are still served throughout database although they are cached copies created on the fly by Boost module (I see those files on the server).

#8

norio - February 4, 2008 - 12:25

Me too :/

Disabled it, deleted everything under /cache, re-enabled and refreshed a page a coupla times but never saw the "cached by" comment.

Here's my .htaccess file in case it helps. (I have about 2 lines of stuff I added in myself)

Edit: Moved quoted .htaccess file into an attachment.

AttachmentSize
htaccess.txt5.3 KB

#9

norio - January 31, 2008 - 17:21
Version:5.x-1.0» 5.x-1.x-dev

Seems to happen with 5.x-1.0 AND 5.x-1.x-dev.

#10

norio - February 3, 2008 - 07:52
Title:Chached pages are created but not served» Cached pages are created but not served
Category:support request» bug report
Priority:normal» critical

Changing this to critical because it effectively makes the module unusable.

#11

norio - February 5, 2008 - 19:11
Assigned to:Anonymous» norio
Status:active» fixed

Got a working solution folks :)

The problem is that the .htaccess directives use the %{SERVER_NAME} variable ($_SERVER["SERVER_NAME"] in PHP) which is a value taken directly from your Apache configuration which, in the case of my web site (and czkuba's site) doesn't include the "www" bit.

So our cache files are being created under www.example.com/cache, but the .htaccess is testing for the existence of cached files under example.com/cache which it NEVER finds so the plain, un-cached version gets served up.

To fix this, I simply replaced all occurrences of %{SERVER_NAME} with my full domain name. I also enabled and edited the first commented rewrite rule that redirects requests for example.com to www.example.com. That should stop cache files from showing up in the wrong directory -- saving space.

Hope this helps someone else out there!

#12

christefanø - February 6, 2008 - 01:06
Status:fixed» active

Thanks, norio! Excellent detective work.

Since you assigned this to yourself, would you be able to write this up for the Boost documentation and contact wulff or Arto?

  http://drupal.org/search/user/wulff
  http://drupal.org/search/user/Arto

This isn't "fixed" until the documentation is updated (in the INSTALL.txt, the comments in the .htaccess or on the project page) so I'm reopening it to make it easier for others to find this issue in the queue.

#13

norio - February 6, 2008 - 08:33

Happy to do that but never done it before so can I have a little guidance? I'd love to contribute more back to Drupal but I just don't know how.

#14

christefanø - February 6, 2008 - 10:09

norio, all you need to do is post a modified boosted.txt file that has the correct .htaccess rules and relevant comments and change the status to "needs review" (so it can be easily found and reviewed by others). At that point others will hopefully chime in and say whether the solution works for them or not. :)

In the end, only wulff and Arto have the ability to update the boosted.txt file in the next release or snapshot (check the "Developers" link on project pages to see a project's maintainers) and it's important for them to review it. I know bjaspan has been working a lot on Boost so maybe he can weigh in here, too.

Meanwhile, anyone can change the status of this issue to "needs work" (and offer some constructive feedback about your solution) or change it to "ready to be committed" (this is usually done by someone other than the person who offers the solution). Your detective work and solution both look sound to me, but I haven't tested it yet (I have an intermittent problem where Boost serves outdated CSS files so I've disabled it for now) so I can't change the status to RTBC.

Hopefully this response is helpful. It's probably too much but you did assign this issue to yourself. :P

#15

norio - February 13, 2008 - 12:51
Status:active» patch (code needs review)

Instead of editing the boosted.txt file, I've added new instructions to the INSTALL.txt file. I hope this will do!

AttachmentSize
INSTALL.txt2.68 KB

#16

norio - February 13, 2008 - 12:56

By the way, Christefano, your problem could probably be solved by finding lines like this:

RewriteCond %{REQUEST_URI} !^/admin

And adding underneath them:

RewriteCond %{REQUEST_URI} !^.*\.css

Personally, I've enabled CSS file aggregating, and I'm using this line (instead of the above) to fix the CSS issue:

RewriteCond %{REQUEST_URI} !^/files/css

Seems to be working fine.

#17

moshe weitzman - February 13, 2008 - 13:13

Seems like that css line should be in our boosted.txt file, no?

#18

norio - February 14, 2008 - 10:59

Sounds good to me. I recommend another similar line for .js files.

#19

snowwind - February 19, 2008 - 09:49

Hi everyone, i want to know how to let this module work with pathauto module?

#20

christefano - February 23, 2008 - 08:23

Thanks, norio. I think that line ought to be rolled into the next release.

#21

greg@wisebread.com - May 26, 2008 - 04:58

@norio - Thanks for the fix!

Symlinking the non-www cache directory to the www cache directory works too, and is a one command fix.

unix> ln -s www.wisebread.com wisebread.com

@snowwind - Boost should work with Pathauto out of the box. You don't need to do anything special.

 
 

Drupal is a registered trademark of Dries Buytaert.