rack-devel archive mirror (unofficial) https://groups.google.com/group/rack-devel
 help / color / mirror / Atom feed
* Rack and Varnish
@ 2011-04-25  3:59 froom
  2011-04-25  8:32 ` Lee Hambley
  0 siblings, 1 reply; 4+ messages in thread
From: froom @ 2011-04-25  3:59 UTC (permalink / raw)
  To: Rack Development

Hi there

So URL1 request is passing through Rack.

Rack decides it needs to render URL2 instead (but not redirect the
browser, just render in place)

Is Rack able to pass the request to Varnish?

Or can Rack only pass on to other application layers, like Rails?

I'd like to pass back directly to Varnish if I can :)    Going
directly to Rails would break my cache.

thanks!

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Rack and Varnish
  2011-04-25  3:59 Rack and Varnish froom
@ 2011-04-25  8:32 ` Lee Hambley
  2011-04-25 13:24   ` froom
  0 siblings, 1 reply; 4+ messages in thread
From: Lee Hambley @ 2011-04-25  8:32 UTC (permalink / raw)
  To: rack-devel

[-- Attachment #1: Type: text/plain, Size: 206 bytes --]

Sounds like you need to have your middleware return the user to the
front-end (Varnish Server) with an appropriate redirect header, be aware of
how Varnish handles redirect codes from it's backends.

- Lee

[-- Attachment #2: Type: text/html, Size: 239 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Rack and Varnish
  2011-04-25  8:32 ` Lee Hambley
@ 2011-04-25 13:24   ` froom
  2011-04-25 14:20     ` Lee Hambley
  0 siblings, 1 reply; 4+ messages in thread
From: froom @ 2011-04-25 13:24 UTC (permalink / raw)
  To: Rack Development

Thanks for the reply

Would rather not return a redirect response to the user/browser...
only want one request cycle

I'd rather Rack decided "I need to return the varnish cached page for
URL2 back to the user immediately".... and I was thinking the best way
to do that is modify the request in some way with a new URL, so almost
like a "restart" for the request, which would give Varnish a chance to
kick in before we bother Rails


Not sure if this is even feasible.... but seems preferable over
memcache storing entire pages for no real reason

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Rack and Varnish
  2011-04-25 13:24   ` froom
@ 2011-04-25 14:20     ` Lee Hambley
  0 siblings, 0 replies; 4+ messages in thread
From: Lee Hambley @ 2011-04-25 14:20 UTC (permalink / raw)
  To: rack-devel

[-- Attachment #1: Type: text/plain, Size: 363 bytes --]

>
> like a "restart" for the request, which would give Varnish a chance to
> kick in before we bother Rails


Sure, so redirect the user… or have your middleware get the page from Rack
for them, and return it (and beware of the significant performance hit, of
having your Ruby stack process cached pages… but at least it wouldn't hit
your Rails app)

[-- Attachment #2: Type: text/html, Size: 542 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-04-25 14:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-25  3:59 Rack and Varnish froom
2011-04-25  8:32 ` Lee Hambley
2011-04-25 13:24   ` froom
2011-04-25 14:20     ` Lee Hambley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).