You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Bill Moseley <mo...@hank.org> on 2006/08/09 07:07:31 UTC

[users@httpd] Reverse Proxy -- excluding files

I'm wonder how to *not* proxy some content.

My existing front uses a simple reverse proxy (and mod_cache) setup.

the proxy setup is:

    Listen 80
    <VirtualHost *:80>
        ServerAlias www.example.com

        <Location />
            Allow from all
        </Location>

        ProxyPass               /  http://127.0.0.1:10080/

    </VirtualHost>

And I also do the following to handle images directly on the front end
server:

    CacheDisable    /images
    ProxyPass       /images !

    <Directory /home/moseley/docroot/images>
        ExpiresActive On
        Allow from all
    </Directory>

I also do that with /css and /js, for example.


If a request comes in for /foo/bar.jpg it will get sent to the
back-end server (the backend handles requests to /foo/ normally).
I'd like to handle that request in the front-end server.  That is,
I'd like to match on, say, /\.(jpe?g|gif|swf|pdf)$/.

The backend has a different document root, so that a request for

    /foo/bar.jpg

would not be proxied and also be re-written as:

    /backend/foo/bar.jpg

The rewrite shouldn't be hard, but I'm not clear how to *not* proxy
the request.

Any suggestions?


(Actually, I could probably *not* proxy any request that has an
extension ([^/]\.\w+$) that doesn't end in .html?  I.e.:

    /foo            - proxy
    /foo/           - proxy
    /foo/bar        - proxy
    /foo/bar.html   - proxy
    /foo/bar.123    - don't proxy

-- 
Bill Moseley
moseley@hank.org


---------------------------------------------------------------------
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] Reverse Proxy -- excluding files

Posted by Vincent Bray <no...@gmail.com>.
On 8/9/06, Bill Moseley <mo...@hank.org> wrote:
> I'm wonder how to *not* proxy some content.

mod_rewrite to the rescue!

> (Actually, I could probably *not* proxy any request that has an
> extension ([^/]\.\w+$) that doesn't end in .html?  I.e.:
>
>     /foo            - proxy
>     /foo/           - proxy
>     /foo/bar        - proxy
>     /foo/bar.html   - proxy
>     /foo/bar.123    - don't proxy

This is probably the easiest approach.

RewriteEngine On
RewriteCond %{REQUEST_URI} !(jpe?g|gif|png)$
RewriteRule (.+) http://localhost:10080$1 [P]
ProxyPassReverse / http://localhost:10080/

-- 
noodl

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