On Aug 3, 1:33 pm, Seth <[EMAIL PROTECTED]> wrote:
> On Aug 3, 1:34 pm, Philip Hallstrom <[EMAIL PROTECTED]> wrote:
>
> > > I am using page caching on a rails site and I want a logged-in admin
> > > to be served the non-cached site. This needs to be done in our nginx
> > > config but I haven't been able to get anything to work.
>
> > > My first (and most logical) attempt was to set a cookie for admins and
> > > have a <p>conditional statement in the nginx config that checks for
> > > that cookie. If it finds it, it should go directly to the proxy_pass.
> > > Here is what that looked like:
>
> > > <pre>
> > > if ($http_cookie ~* "nocached=true") {
> > > proxy_passhttp://mongrel;
> > > break;
> > > }
> > > </pre>
>
> > > This did not work. If I put a rewrite line in that conditional
> > > statement, it works. That means it is recognizing the cookie
> > > correctly and that there is a problem with my approach. I think I
> > > might need to use different syntax to use only the mongrels and not
> > > load the cached pages but I don't know what that would look like. If
> > > you have tried something like this, I'd love to hear what you found.
> > > Thanks!
>
> > It might be working... mongrel will serve up files cached into public as
> > well. So the above might very well be handing it to mongrel, mongrel sees
> > the cached file and serves it up on it's own.
>
> > -philip
>
> Wow, I had not considered that. I will change the location of the
> cached pages to public/cache and have nginx serve cached pages from
> there. That way, Mongrel won't recognize that there are static files
> for the requests. I will let you know if that works. Thanks philip!
Alright, that did the trick. The only other problem I ran into is
that the $request_filename variable is an absolute path. I had been
trying to use that variable in a path like $document_root/cache/
$request_filename.html - this didn't work, I had to use the $uri
variable instead: $document_root/cache/$uri.html
Thanks again!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Deploying Rails" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-deployment?hl=en
-~----------~----~----~----~------~----~------~--~---