Rails Caching

jp_n9

Active Member
#1
I setup Rails Caching using the caches_page method. I can see the files being created in /public, yet according to the production.log Rails is still processing every file.

Any ideas??? Do I need to setup a directive in the VirtualHost for the Rails app, or could it be arouting problem, or something else?

Thanks!!
 

mistwang

LiteSpeed Staff
#2
Not sure what cause that, the URL must be exactly as the the file name, index file should be set properly.

You can turn on debug logging see what exactly is happening.
 

jp_n9

Active Member
#3
Not sure what cause that, the URL must be exactly as the the file name, index file should be set properly.

You can turn on debug logging see what exactly is happening.
An example URL is http://www.domain.com/view/page/17

On my server I have

/domain/current/public/view/page/17.html

Now, I noticed in the VirtualHost that under the "Rewrite" tab, "Enable rewrite" is off by default. Do I need to turn that on for LS to be able to turn .../page/17 into .../page/17.html??

Any other settings that "should" be right but might be a good idea for me to double check?

Thanks for all your help!!

I'll send you a copy via PM of the error.log with the highest level of debugging for a request.
 
Last edited:

jp_n9

Active Member
#5
I tried turning it on, but it doesn't seem to have changed anything. Ooops. Just saw you said the URL needs to be rewritten. How?
 

jp_n9

Active Member
#7
You can just turn on .htaccess support, the rewrite rules in public/.htaccess should take care of it.
I found the "Allow Override" setting, but it has a bunch of check boxes which aren't explained - so I'm not sure how to "turn on" the .htaccess support. I tried checking all except for the "none" and restarted. Didn't seem to work.

I then adding the following rewrite rules copied from .htacess:

RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.cgi [QSA,L]

I restarted. Again, it still doesn't seem to be working.

What am I doing wrong?
 

mistwang

LiteSpeed Staff
#8
rewrite rules in .htaccess are slightly different from rules at vhost level. The rewrite base (directory path) has been removed for rewrite rules in .htaccess. You need to modify those rewrite rules to take care of this.

try something like

RewriteRule ^(.*)/$ $1/index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]


Or, you can turn off htaccess and use those rules in the rails context configuration, but not at the vhost level.
 
Top