httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bill Moseley <mose...@hank.org>
Subject [users@httpd] Using .htaccess in a front-end/back-end setup
Date Mon, 04 Sep 2006 19:52:24 GMT
I have a front-end apache that proxies most requests to a back end
server.  I use mod_rewrite to determine what should go to the
back-end server.

Basically, I'm wonder when in the request cycle Apache deals with
.htaccess.  I guess it would have to be after mod_rewrite because
mod_rewrite can, well, rewrite the request.

The problem is a request in our setup for /foo/bar.html is handled by
the back end server where /foo/bar.pdf is handled by the front end
server.

More specifically: 

Basically, all request execpt  /js, /css and requests that have an extension that
*isn't* .html then it's handled by the front-end server (as pure
static content).

Then everything else goes to the back end server -- which is the app
server:

        RewriteCond %{REQUEST_URI} !/js/
        RewriteCond %{REQUEST_URI} !/css/
        RewriteCond %{REQUEST_URI} \.\w+$
        RewriteCond %{REQUEST_URI} !\.html$
        RewriteRule ^/(.+)$ /domains/default/$1             [last]

        # Proxy everything else
        RewriteRule (.+) http://127.0.0.1:10080$1 [proxy]

It's a somewhat confusing setup in that the front-end and back-end
have basically the same document root so in a directory

    <docroot>/foo
        index.html      - servered by the back end server
        foo.pdf         - served by the front end server.


Of course, now the client want to use .htaccess.  But, for requests
that get proxied .htaccess is never read (because the request has
been sent to the backend server).

What I'd like to do is, before mod_rewrite looks at the request and
proxies to the back-end, be able to 1) Redirect, and 2) use Basic
Auth to control access.

Any suggestions?


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


Mime
View raw message