Hi all,
I have several rails apps running under a single vhost under contexts like '/v1', '/v2', '/v3' - all work fine with no page caching enabled.
When I enable page caching for some actions, rails is correctly generating the cache files in <RAILS_ROOT>/public (or whatever dir I set config.action_controller.page_cache_directory to) but Litespeed isn't serving the cached files - it always dispatches the request to the rails app (via dispatch.lsapi)
Enabling litespeed debug, I'm noticing the following when I request a URL that I know has been cached (I can see the cache file on the server e.g. <RAILS_ROOT>/v1/groups.atom)
GET /v1/groups.atom HTTP/1.1
2008-08-07 17:17:34.187 [INFO] [127.0.0.1:55487-0#aehso] [REWRITE] Rule: Match '/v1/groups.atom' with pattern '^(.*)/$', result: -1
2008-08-07 17:17:34.187 [INFO] [127.0.0.1:55487-0#aehso] [REWRITE] Rule: Match '/v1/groups.atom' with pattern '^([^.]+)$', result: -1
2008-08-07 17:17:34.187 [DEBUG] [127.0.0.1:55487-0#aehso] Find context with URI: [/v1/], location: [/trunk/rails1/public/]
2008-08-07 17:17:34.187 [DEBUG] [127.0.0.1:55487-0#aehso] File not found [/trunk/rails1/public/groups.atom]
2008-08-07 17:17:34.187 [DEBUG] [127.0.0.1:55487-0#aehso] processContextPath() return 25
2008-08-07 17:17:34.187 [DEBUG] [127.0.0.1:55487-0#aehso] processNewReq() return 25.
2008-08-07 17:17:34.187 [DEBUG] [127.0.0.1:55487-0#aehso] HttpConnection::sendHttpError(),code=404 Not Found
2008-08-07 17:17:34.187 [DEBUG] [127.0.0.1:55487-0#aehso] redirect to:
URI=[/v1/dispatch.lsapi],
QueryString=[]
Some quick env parms for context:
VH_ROOT=/trunk/rails1 (RAILS_ROOT)
DOC_ROOT=/trunk/rails1/public
Rails Context '/v1' - Location = $VH_ROOT
The cached file in the above instance is actually in /trunk/rails1/public/v1/groups.atom
I'm trying to find a way to fix this but I've had no luck.
- the Vhost DOC_ROOT seems to be ignored, no matter what I set it to.
- I can't change the context root to '/' as we have other rails apps running under different contexts ('/v1', '/v2', '/v3' etc)
- I can't hack (rewrite) the something like /v1/v1/groups.atom as if the cached file doesn't exist, the lsapi redirect still needs to work.
lsws really seems to be hardcoded to appending 'public' onto the url context location dir and then stripping off the url context prefix before looking for the file. Ideally it would look in DOC_ROOT (which I could perhaps set to $VH_ROOT/pubic/v1) but that doesn't seem to happen at all for me.
Any suggestions?
cheers,
John.
I have several rails apps running under a single vhost under contexts like '/v1', '/v2', '/v3' - all work fine with no page caching enabled.
When I enable page caching for some actions, rails is correctly generating the cache files in <RAILS_ROOT>/public (or whatever dir I set config.action_controller.page_cache_directory to) but Litespeed isn't serving the cached files - it always dispatches the request to the rails app (via dispatch.lsapi)
Enabling litespeed debug, I'm noticing the following when I request a URL that I know has been cached (I can see the cache file on the server e.g. <RAILS_ROOT>/v1/groups.atom)
GET /v1/groups.atom HTTP/1.1
2008-08-07 17:17:34.187 [INFO] [127.0.0.1:55487-0#aehso] [REWRITE] Rule: Match '/v1/groups.atom' with pattern '^(.*)/$', result: -1
2008-08-07 17:17:34.187 [INFO] [127.0.0.1:55487-0#aehso] [REWRITE] Rule: Match '/v1/groups.atom' with pattern '^([^.]+)$', result: -1
2008-08-07 17:17:34.187 [DEBUG] [127.0.0.1:55487-0#aehso] Find context with URI: [/v1/], location: [/trunk/rails1/public/]
2008-08-07 17:17:34.187 [DEBUG] [127.0.0.1:55487-0#aehso] File not found [/trunk/rails1/public/groups.atom]
2008-08-07 17:17:34.187 [DEBUG] [127.0.0.1:55487-0#aehso] processContextPath() return 25
2008-08-07 17:17:34.187 [DEBUG] [127.0.0.1:55487-0#aehso] processNewReq() return 25.
2008-08-07 17:17:34.187 [DEBUG] [127.0.0.1:55487-0#aehso] HttpConnection::sendHttpError(),code=404 Not Found
2008-08-07 17:17:34.187 [DEBUG] [127.0.0.1:55487-0#aehso] redirect to:
URI=[/v1/dispatch.lsapi],
QueryString=[]
Some quick env parms for context:
VH_ROOT=/trunk/rails1 (RAILS_ROOT)
DOC_ROOT=/trunk/rails1/public
Rails Context '/v1' - Location = $VH_ROOT
The cached file in the above instance is actually in /trunk/rails1/public/v1/groups.atom
I'm trying to find a way to fix this but I've had no luck.
- the Vhost DOC_ROOT seems to be ignored, no matter what I set it to.
- I can't change the context root to '/' as we have other rails apps running under different contexts ('/v1', '/v2', '/v3' etc)
- I can't hack (rewrite) the something like /v1/v1/groups.atom as if the cached file doesn't exist, the lsapi redirect still needs to work.
lsws really seems to be hardcoded to appending 'public' onto the url context location dir and then stripping off the url context prefix before looking for the file. Ideally it would look in DOC_ROOT (which I could perhaps set to $VH_ROOT/pubic/v1) but that doesn't seem to happen at all for me.
Any suggestions?
cheers,
John.