LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > External Applications > Ruby/Rails > Rails Caching

Reply
 
Thread Tools Display Modes
  #1  
Old 10-13-2006, 11:07 PM
jp_n9 jp_n9 is offline
Member
 
Join Date: Sep 2006
Posts: 38
Default Rails Caching

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!!
Reply With Quote
  #2  
Old 10-14-2006, 06:54 AM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
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.
Reply With Quote
  #3  
Old 10-14-2006, 08:25 PM
jp_n9 jp_n9 is offline
Member
 
Join Date: Sep 2006
Posts: 38
Quote:
Originally Posted by mistwang View Post
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 by jp_n9; 10-14-2006 at 08:43 PM..
Reply With Quote
  #4  
Old 10-14-2006, 08:30 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
Yes, you need to rewrite the url.
Reply With Quote
  #5  
Old 10-14-2006, 08:46 PM
jp_n9 jp_n9 is offline
Member
 
Join Date: Sep 2006
Posts: 38
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?
Reply With Quote
  #6  
Old 10-14-2006, 08:54 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
You can just turn on .htaccess support, the rewrite rules in public/.htaccess should take care of it.
Reply With Quote
  #7  
Old 10-14-2006, 09:16 PM
jp_n9 jp_n9 is offline
Member
 
Join Date: Sep 2006
Posts: 38
Quote:
Originally Posted by mistwang View Post
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?
Reply With Quote
  #8  
Old 10-14-2006, 09:31 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
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.
Reply With Quote
  #9  
Old 10-15-2006, 08:12 AM
jp_n9 jp_n9 is offline
Member
 
Join Date: Sep 2006
Posts: 38
Quote:
Originally Posted by mistwang View Post

try something like

RewriteRule ^(.*)/$ $1/index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
I turned off .htaccess and added the above rewrite rules in at the vhost level. Works great!! Thanks!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 09:10 AM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.