<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><DIV>Hi all. I'm trying to skip the Rails page cache if the user is logged in:</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>---</DIV><DIV> # Rewrite index to check for static</DIV><DIV>RewriteCond %{HTTP_COOKIE} !^.*logged_in=yes.*$</DIV><DIV>RewriteRule ^/$ /index.html [QSA]</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV># Rewrite to check for Rails cached page</DIV><DIV>RewriteCond %{HTTP_COOKIE} !^.*logged_in=yes.*$</DIV><DIV>RewriteRule ^([^.]+)$ $1.html [QSA]</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV># Redirect all non-static requests to cluster</DIV><DIV>RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f</DIV><DIV>RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} [P,QSA,L]</DIV><DIV>---</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>It does seem to work -- here's sample rewrite debug for "/":</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>---</DIV><DIV>(2) init rewrite engine with requested uri /</DIV><DIV>(3) applying pattern '^.*$' to uri '/'</DIV><DIV>(4) RewriteCond: input='/var/sites/production/public/system/maintenance.html' pattern='-f' => not-matched</DIV><DIV>(3) applying pattern '^/$' to uri '/'</DIV><DIV>(4) RewriteCond: input='[other cookies]; logged_in=yes;' pattern='!^.*logged_in=yes.*$' => not-matched</DIV><DIV>(3) applying pattern '^([^.]+)$' to uri '/'</DIV><DIV>(4) RewriteCond: input='[other cookies]; logged_in=yes;' pattern='!^.*logged_in=yes.*$' => not-matched</DIV><DIV>(3) applying pattern '^/(.*)$' to uri '/'</DIV><DIV>(4) RewriteCond: input='/var/sites/production/public//' pattern='!-f' => matched</DIV><DIV>(2) rewrite '/' -> 'balancer://mongrel_cluster/'</DIV><DIV>(2) forcing proxy-throughput with balancer://mongrel_cluster/</DIV><DIV>(1) go-ahead with proxy request proxy:balancer://mongrel_cluster/ [OK]</DIV><DIV>---</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>(As opposed to "go-ahead with /var/sites/production/public/index.html", if the user's not logged in.)</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Problem: The static file is still being served to the browser. Can anyone tell me what I'm missing here?</DIV><DIV><BR class="khtml-block-placeholder"></DIV><BR><DIV> <SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><DIV>Shinji Kuwayama</DIV><DIV><A href="mailto:shinji@kuwayama.com">shinji@kuwayama.com</A></DIV><DIV><BR class="khtml-block-placeholder"></DIV><BR class="Apple-interchange-newline"></SPAN> </DIV><BR></BODY></HTML>