Rails page caching with multiple domains same vhost

#1
Hi,

I have multiple domains running from the same vhost. I have enable page caching in Rails to speed things up, but Litespeed isn't serving these caches. Below is an example to explain the problem. Suppose I have three domains running from the same vhost: www.a.com, www.b.com and www.c.com . Now when somebody visits www.a.com the directory /vhost/public/www.a.com gets generated. When somebody visits www.c.com the directory /vhost/public/www.c.com and so on. But Litespeed doesn't look in these directories but instead only looks in /vhost/public. How can I change this? Thanks.

Kind regards,

Nick
 
#3
Found the rewrite rule under the rails context, I tried the following rule:

RewriteRule ^/public/index.html ^/public/%{HTTP_HOST}/index.html [L,R]

But that didn't do it. Are there standard rules for this, since Litespeed already looks for cached pages when there is only one domain. Thanks.

Kind regards,

Nick
 

mistwang

LiteSpeed Staff
#4
I think it should be

RewriteRule index.html /%{HTTP_HOST}/index.html [L,R]

context level rewrite rule will remove rewrite base from URL.
 
#5
Ok, I found the correct rewrite rule. But I have encountered two problems:

1. when there is no cached file Litespeed returns file not found. It should however instantiate Rails so that a cached file can be generated
2. http://www.a.com/file/show/1 gets redirected to http://www.a.com/domain_name/file/show/1 . But I don't want my visitors, nor the search engines to see this new redirected url.

How can I solve these two issues? Thanks.

Kind regards,

Nick
 
Top