rack-devel archive mirror (unofficial) https://groups.google.com/group/rack-devel
 help / color / mirror / Atom feed
* Rack:Static with other middlewares
@ 2010-04-21  3:22 Matthew M. Boedicker
  2010-04-21  5:53 ` Konstantin Haase
  0 siblings, 1 reply; 4+ messages in thread
From: Matthew M. Boedicker @ 2010-04-21  3:22 UTC (permalink / raw)
  To: rack-devel

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

When Rack::Static is used under Passenger it seems like the request is
served by Apache and none of the other middlewares in the chain are run. Is
this correct?

Is there any way to serve static files but also run them through other
middlewares such as deflater and cache? When running under rackup it uses
all the middleware and I would like the application to always behave the
same.


-- 
Subscription settings: http://groups.google.com/group/rack-devel/subscribe?hl=en

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

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

* Re: Rack:Static with other middlewares
  2010-04-21  3:22 Rack:Static with other middlewares Matthew M. Boedicker
@ 2010-04-21  5:53 ` Konstantin Haase
  2010-04-21 22:56   ` Matthew M. Boedicker
  0 siblings, 1 reply; 4+ messages in thread
From: Konstantin Haase @ 2010-04-21  5:53 UTC (permalink / raw)
  To: rack-devel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


On Apr 21, 2010, at 05:22 , Matthew M. Boedicker wrote:

> When Rack::Static is used under Passenger it seems like the request is served by Apache and none of the other middlewares in the chain are run. Is this correct?

Usually you want that behavior, as Apache is much better at throwing static files at the browser. Handing the data through your application is a rather large overhead.

> Is there any way to serve static files but also run them through other middlewares such as deflater and cache? When running under rackup it uses all the middleware and I would like the application to always behave the same.
> 

Use File.read or something instead of Rack::Static. If it's only about deflation/cashing, then you might want to consider setting that up on apache or even load balancer level.

Konstantin

-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.14 (Darwin)

iQEcBAEBAgAGBQJLzpLqAAoJEM+qkfuqK1IXJuQIALUP92l8SimI94g3bkWfcDLM
y7EwHYiOWpPln83qZl/7ug931yxC3Q0MI7reRiJnqj6F96QDvMWS2/9kDb+BF/op
Rlvl1imEF3OW5ug+ZZHJduqm2QXldPZBNd/SJHMmUMXZth3xakl1mNbxL/gkm0Ou
lyYBxJBl/VhXcImpju997//5jfPcqeXukyi0Ea3RE3q1iQepkM9lXqBKvJ3gdI4B
o8Xn2+A4Sbus0TzI0LB19r0Vz+tvdtl9I3wbEvpq310ghcUEDsx59a5wvjfBKWOc
eEq9ABQNjK2Is/ekTsTrBwnHiCVGzEj2Yrmv+Zsq5yZDykrRg3DHk4kGEXKI8xM=
=j9Lj
-----END PGP SIGNATURE-----


-- 
Subscription settings: http://groups.google.com/group/rack-devel/subscribe?hl=en

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

* Re: Rack:Static with other middlewares
  2010-04-21  5:53 ` Konstantin Haase
@ 2010-04-21 22:56   ` Matthew M. Boedicker
  2010-04-26 20:28     ` Mateo Murphy
  0 siblings, 1 reply; 4+ messages in thread
From: Matthew M. Boedicker @ 2010-04-21 22:56 UTC (permalink / raw)
  To: rack-devel

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

After more testing it looks like it was calling other middlewares for
Rack::Static served files, but not if they were in the public directory.
Passenger skips rack entirely for anything in public (where rackup sends
those requests through rack). Not sure if this is the default Passenger
behavior or something that my host has configured.

On Wed, Apr 21, 2010 at 1:53 AM, Konstantin Haase <k.haase@finn.de> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
>
> On Apr 21, 2010, at 05:22 , Matthew M. Boedicker wrote:
>
> > When Rack::Static is used under Passenger it seems like the request is
> served by Apache and none of the other middlewares in the chain are run. Is
> this correct?
>
> Usually you want that behavior, as Apache is much better at throwing static
> files at the browser. Handing the data through your application is a rather
> large overhead.
>
> > Is there any way to serve static files but also run them through other
> middlewares such as deflater and cache? When running under rackup it uses
> all the middleware and I would like the application to always behave the
> same.
> >
>
> Use File.read or something instead of Rack::Static. If it's only about
> deflation/cashing, then you might want to consider setting that up on apache
> or even load balancer level.
>
> Konstantin
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG/MacGPG2 v2.0.14 (Darwin)
>
> iQEcBAEBAgAGBQJLzpLqAAoJEM+qkfuqK1IXJuQIALUP92l8SimI94g3bkWfcDLM
> y7EwHYiOWpPln83qZl/7ug931yxC3Q0MI7reRiJnqj6F96QDvMWS2/9kDb+BF/op
> Rlvl1imEF3OW5ug+ZZHJduqm2QXldPZBNd/SJHMmUMXZth3xakl1mNbxL/gkm0Ou
> lyYBxJBl/VhXcImpju997//5jfPcqeXukyi0Ea3RE3q1iQepkM9lXqBKvJ3gdI4B
> o8Xn2+A4Sbus0TzI0LB19r0Vz+tvdtl9I3wbEvpq310ghcUEDsx59a5wvjfBKWOc
> eEq9ABQNjK2Is/ekTsTrBwnHiCVGzEj2Yrmv+Zsq5yZDykrRg3DHk4kGEXKI8xM=
> =j9Lj
> -----END PGP SIGNATURE-----
>
>
> --
> Subscription settings:
> http://groups.google.com/group/rack-devel/subscribe?hl=en
>

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

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

* Re: Rack:Static with other middlewares
  2010-04-21 22:56   ` Matthew M. Boedicker
@ 2010-04-26 20:28     ` Mateo Murphy
  0 siblings, 0 replies; 4+ messages in thread
From: Mateo Murphy @ 2010-04-26 20:28 UTC (permalink / raw)
  To: rack-devel


On 21-Apr-10, at 6:56 PM, Matthew M. Boedicker wrote:

> After more testing it looks like it was calling other middlewares  
> for Rack::Static served files, but not if they were in the public  
> directory. Passenger skips rack entirely for anything in public  
> (where rackup sends those requests through rack). Not sure if this  
> is the default Passenger behavior or something that my host has  
> configured.

This is standard Passenger behavior, as in most cases this is exactly  
what you want


-- 
Subscription settings: http://groups.google.com/group/rack-devel/subscribe?hl=en

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

end of thread, other threads:[~2010-04-26 20:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-21  3:22 Rack:Static with other middlewares Matthew M. Boedicker
2010-04-21  5:53 ` Konstantin Haase
2010-04-21 22:56   ` Matthew M. Boedicker
2010-04-26 20:28     ` Mateo Murphy

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).