Page caching not working outside of public/ on Dreamhost

1 view
Skip to first unread message

realbooklisten

unread,
Oct 5, 2010, 4:23:51 PM10/5/10
to Phusion Passenger Discussions
I cache thousands of pages so it would be a maintenance nightmare to
use the default directory. I've had the following setup working since
Phusion was launched on Dreamhost:

Environment.rb:

# See Rails::Configuration for more options
config.action_controller.perform_caching = true
config.action_controller.page_cache_directory = RAILS_ROOT+"/public/
cache/"

and .htaccess

RewriteEngine On

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


Dreamhost just recently moved my server and upgraded to Debian Lenny,
since then this config doesn't work. it seems that the rewritten URL
(instead of original) is sent to phusion if it is not in the cache:

Oct 05 13:13:07 monoceros rails[1443]: Parameters:
{"action"=>"rescue_404", "path"=>["cache", "O.html"],
"controller"=>"application"}

When I remove .htaccess everything works fine, only i'm never using
the cache.

Any ideas ?

Cedric

unread,
Oct 22, 2010, 12:02:15 PM10/22/10
to Phusion Passenger Discussions
No solution on my side yet, but got the same issue with 3.0.0 final,
on my own dedicated servers.
The following used to work perfectly under 2.2.x.

Apache mod_rewrite rules:

RewriteCond %{THE_REQUEST} ^(GET|HEAD)
RewriteCond %{QUERY_STRING} ^$
RewriteCond %{REQUEST_URI} ^([^.]+[^/])[/]?$
RewriteCond %{DOCUMENT_ROOT}/path/to/page/cache/$1.html -f
RewriteRule ^([^.]+[^/])[/]?$ path/to/page/cache/$1.html [L]

With 3.0.0, instead of serving static cached pages directly from
apache, it forwards the rewritten URLs to the Rails app (path/to/page/
cache/whatever.html => 404).
Switching back to 2.2.x immediately solves the issue.

Kind of major bug for me :(
Shall a ticket be opened?

Best,
Cedric

Hongli Lai

unread,
Oct 22, 2010, 3:37:28 PM10/22/10
to phusion-...@googlegroups.com
On Fri, Oct 22, 2010 at 6:02 PM, Cedric <cedri...@gmail.com> wrote:
> No solution on my side yet, but got the same issue with 3.0.0 final,
> on my own dedicated servers.
> The following used to work perfectly under 2.2.x.
>
> Apache mod_rewrite rules:
>
> RewriteCond %{THE_REQUEST} ^(GET|HEAD)
> RewriteCond %{QUERY_STRING} ^$
> RewriteCond %{REQUEST_URI} ^([^.]+[^/])[/]?$
> RewriteCond %{DOCUMENT_ROOT}/path/to/page/cache/$1.html -f
> RewriteRule ^([^.]+[^/])[/]?$ path/to/page/cache/$1.html [L]
>
> With 3.0.0, instead of serving static cached pages directly from
> apache, it forwards the rewritten URLs to the Rails app (path/to/page/
> cache/whatever.html => 404).
> Switching back to 2.2.x immediately solves the issue.
>
> Kind of major bug for me :(
> Shall a ticket be opened?

Yes please open a ticket.

--
Phusion | The Computer Science Company

Web: http://www.phusion.nl/
E-mail: in...@phusion.nl
Chamber of commerce no: 08173483 (The Netherlands)

Reply all
Reply to author
Forward
0 new messages