You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Michael Zedeler <mi...@zedeler.dk> on 2004/06/30 00:17:05 UTC

[users@httpd] Re: Reverse proxy -- is it possible to cache some pages and not others?

Jen Wu wrote:
> I have Apache setup as a reverse proxy -- requests to my Web site go to
> Apache, [cut]. The tricky part here is that some of the Miva
> pages can be cached, but some can't be cached. Is this possible to do with
> mod_proxy? For example, is it possible to say only cache these directories
> but not others? [cut]

Yes. You can do this using mod_rewrite. Look in

http://httpd.apache.org/docs-2.0/misc/rewriteguide.html#ToC2

under the section "dynamic mirror". Beware that mod_rewrite has lots of 
caveats, but when set up right, it can do a lot of nice things.

> I noticed that there's a NoCache directive -- but it seems like this is
> meant for specifying entire hosts not be cached?

Thats for Apache 1.3, so I assume thats the server you are running. You 
are right that NoCache isn't very fine grained.

Take a look at mod_rewrite.

Regards,

Michael.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


[users@httpd] Re: Reverse proxy -- is it possible to cache some pages and not others?

Posted by Jen-Mei Wu <je...@colorfulexpressions.com>.
Nick Kew wrote:
> Apache 1.3's mod_proxy only supports HTTP/1.0.  So you miss out on
> the cache control that is probably the single most important change
> between HTTP/1.0 and 1.1.

So it seems like being able to cache some pages and not others (without 
modifying headers) isn't possible without using mod_cache and Apache 2.0?

Thanks,

Jen


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Re: Reverse proxy -- is it possible to cache some pages and not others?

Posted by Nick Kew <ni...@webthing.com>.
On Tue, 29 Jun 2004, Jen Wu wrote:

> Yep, we're running Apache 1.3.

Apache 1.3's mod_proxy only supports HTTP/1.0.  So you miss out on
the cache control that is probably the single most important change
between HTTP/1.0 and 1.1.

-- 
Nick Kew

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


[users@httpd] Re: Reverse proxy -- is it possible to cache some pages and not others?

Posted by Jen Wu <je...@colorfulexpressions.com>.
"Michael Zedeler" <mi...@zedeler.dk> wrote in message
news:cbspp8$ecs$1@sea.gmane.org...
> Thats for Apache 1.3, so I assume thats the server you are running. You
> are right that NoCache isn't very fine grained.
>
> Take a look at mod_rewrite.

Yep, we're running Apache 1.3. Also, we're using mod_rewrite already, using
the P flag to send stuff to mod_proxy. But from my understanding, this
requires the Web server that we're proxying for to provide expires headers.
I spoke with the person who set this up and his understanding is that as
long as a page has an expires header in the future and as long as there is
no pragma-nocache header. Is this not correct?

What we'd like is to be able to cache something without having to deal with
headers.

Another problem we've run into is that a lot of times a browser will ask
whether a file has changed, which will still get sent to the application
server. The app server will then send back a 304 response to say it hasn't
changed, but that's still a hit. Is there a way to setup mod_proxy so that
it will send the 304 response if the file is in cache? I realize this
partially defeats the point of being able to send cache information in
headers, but having the app. server respond with a 304 for files that
haven't changed seems to be problematic.

This is how we are using mod_proxy, mod_rewrite, and mod_expire right now:

        CacheRoot /tmp/proxy-www
        CacheSize 10000
        CacheGcInterval 2
        CacheMaxExpire 24
        CacheLastModifiedFactor 0.1
        CacheDefaultExpire 1
        CacheForceCompletion 100
        ExpiresActive On
        ExpiresByType image/gif A3600
        ExpiresByType image/png A3600
        ExpiresByType image/jpeg A3600
        ExpiresByType text/css A3600
        ExpiresByType text/javascript A3600
        ExpiresByType application/x-javascript A3600
        ExpiresByType text/html A3600
        ExpiresByType text/xml A3600

        RewriteEngine On
        RewriteCond %{REQUEST_URI}
!^/(Merchant2|catalog|page|icons|cgi-bin|_|qwkred|store_map_TIB).*
        RewriteRule ^/(.*)
http://localhost:8080/VirtualHostBase/http/www.xyz.dom:80/Plone/VirtualHostRoot/$1
[L,P]
        ProxyPassReverse /
http://localhost:8080/VirtualHostBase/http/www.xyz.dom:80/Plone/VirtualHostRoot/
        ProxyVia On

Thanks!

Jen




---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org