Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Apache: Users

rewrite and proxy question

 

 

Apache users RSS feed   Index | Next | Previous | View Threaded


kclair at gmail

Jun 30, 2009, 6:41 AM

Post #1 of 4 (433 views)
Permalink
rewrite and proxy question

Hi All,

I'm trying to figure out if the following is possible. Let me know if
anyone has any ideas!

I have a webserver that takes all incoming requests, and I am trying
to proxy all coldfusion requests to another server.

So I have set up a rewrite to catch the requests based on filenames
and proxy them, like so:
RewriteCond %{REQUEST_FILENAME} .*\.cfm|cfc|cfml|jsp|jws$ [NC]
RewriteRule ^(.*)$ http://192.168.0.100/$1 [P]

This is configured to apply across many virtual hosts, so the proxy
server needs to know the requested hostname. Therefor, I'm also using
ProxyPreserveHost On in the server config.

This is all working splendidly except for directory requests which
come in as /, and where the index file is index.cfm. To catch these
requests, it seems I need to put the rewrite in a .htaccess file.
However, ProxyPreserveHost cannot go in the .htaccess file, and it
being set to On in the main server config is not carrying over to the
.htaccess file. So when the rewrite goes in the .htaccess file,
requests to / get properly proxied, but the proxy server cannot answer
correctly because the requested hostname is lost.

Thoughts?? and Thanks!
-K

---------------------------------------------------------------------
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 [at] httpd
" from the digest: users-digest-unsubscribe [at] httpd
For additional commands, e-mail: users-help [at] httpd


icicimov at gmail

Jun 30, 2009, 5:52 PM

Post #2 of 4 (404 views)
Permalink
Re: rewrite and proxy question [In reply to]

What about this:

DirectoryIndex index.cfm

Or maybe changing the redirect to

RewriteRule ^/(.*)$ http://192.168.0.100/$1 [P]



On Tue, Jun 30, 2009 at 11:41 PM, K. Clair <kclair [at] gmail> wrote:

> Hi All,
>
> I'm trying to figure out if the following is possible. Let me know if
> anyone has any ideas!
>
> I have a webserver that takes all incoming requests, and I am trying
> to proxy all coldfusion requests to another server.
>
> So I have set up a rewrite to catch the requests based on filenames
> and proxy them, like so:
> RewriteCond %{REQUEST_FILENAME} .*\.cfm|cfc|cfml|jsp|jws$ [NC]
> RewriteRule ^(.*)$ http://192.168.0.100/$1 [P]
>
> This is configured to apply across many virtual hosts, so the proxy
> server needs to know the requested hostname. Therefor, I'm also using
> ProxyPreserveHost On in the server config.
>
> This is all working splendidly except for directory requests which
> come in as /, and where the index file is index.cfm. To catch these
> requests, it seems I need to put the rewrite in a .htaccess file.
> However, ProxyPreserveHost cannot go in the .htaccess file, and it
> being set to On in the main server config is not carrying over to the
> .htaccess file. So when the rewrite goes in the .htaccess file,
> requests to / get properly proxied, but the proxy server cannot answer
> correctly because the requested hostname is lost.
>
> Thoughts?? and Thanks!
> -K
>
> ---------------------------------------------------------------------
> 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 [at] httpd
> " from the digest: users-digest-unsubscribe [at] httpd
> For additional commands, e-mail: users-help [at] httpd
>
>


kclair at gmail

Jul 1, 2009, 5:56 AM

Post #3 of 4 (391 views)
Permalink
Re: rewrite and proxy question [In reply to]

Hi, I realized I forgot to mention we are running apache 2.0. On Tue, June
30, 2009 8:52 pm, Igor Cicimov wrote: > What about this: > > DirectoryIndex
index.cfm this was already set in our server config. > > Or maybe changing
the redirect to > > RewriteRule ^/(.*)$ http://192.168.0.100/$1 [P] > this
doesn't help. this is (part of) the log line for the initial request:
[rid#ccdee58/initial] (4) RewriteCond: input='/'
pattern='.*\.cfm|cfc|cfml|jsp|jws$' => not -matched it isn't until after it
processes the .htaccess file in the domain's docroot that i see this in the
rewrite log: rid#ccef280/subreq] (2) init rewrite engine with requested uri
/index.cfm i need to use the proxy rewrite at this point, but it seems like
by this point i lose the ability to preserve the requested hostname for the
proxy server (for which i can use ProxyPreserveHost On in the server config
or vhost block). > > On Tue, Jun 30, 2009 at 11:41 PM, K. Clair wrote: > >>
Hi All, >> >> I'm trying to figure out if the following is possible. Let me
know if >> anyone has any ideas! >> >> I have a webserver that takes all
incoming requests, and I am trying >> to proxy all coldfusion requests to
another server. >> >> So I have set up a rewrite to catch the requests based
on filenames >> and proxy them, like so: >> RewriteCond %{REQUEST_FILENAME}
.*\.cfm|cfc|cfml|jsp|jws$ [NC] >> RewriteRule ^(.*)$
http://192.168.0.100/$1[P] >> >> This is configured to apply across
many virtual hosts, so the
proxy >> server needs to know the requested hostname. Therefor, I'm also
using >> ProxyPreserveHost On in the server config. >> >> This is all
working splendidly except for directory requests which >> come in as /, and
where the index file is index.cfm. To catch these >> requests, it seems I
need to put the rewrite in a .htaccess file. >> However, ProxyPreserveHost
cannot go in the .htaccess file, and it >> being set to On in the main
server config is not carrying over to the >> .htaccess file. So when the
rewrite goes in the .htaccess file, >> requests to / get properly proxied,
but the proxy server cannot answer >> correctly because the requested
hostname is lost. >> >> Thoughts?? and Thanks! >> -K >>
[]


icicimov at gmail

Jul 1, 2009, 4:12 PM

Post #4 of 4 (383 views)
Permalink
Re: rewrite and proxy question [In reply to]

One way to preserve the host name is putting

UseCanonicalName On

in the virtual host but not sure if it helps in your case.

On Wed, Jul 1, 2009 at 10:56 PM, K. Clair <kclair [at] gmail> wrote:

> Hi, I realized I forgot to mention we are running apache 2.0. On Tue, June
> 30, 2009 8:52 pm, Igor Cicimov wrote: > What about this: > > DirectoryIndex
> index.cfm this was already set in our server config. > > Or maybe changing
> the redirect to > > RewriteRule ^/(.*)$ http://192.168.0.100/$1 [P] > this
> doesn't help. this is (part of) the log line for the initial request:
> [rid#ccdee58/initial] (4) RewriteCond: input='/'
> pattern='.*\.cfm|cfc|cfml|jsp|jws$' => not -matched it isn't until after it
> processes the .htaccess file in the domain's docroot that i see this in the
> rewrite log: rid#ccef280/subreq] (2) init rewrite engine with requested uri
> /index.cfm i need to use the proxy rewrite at this point, but it seems like
> by this point i lose the ability to preserve the requested hostname for the
> proxy server (for which i can use ProxyPreserveHost On in the server config
> or vhost block). > > On Tue, Jun 30, 2009 at 11:41 PM, K. Clair wrote: > >>
> Hi All, >> >> I'm trying to figure out if the following is possible. Let me
> know if >> anyone has any ideas! >> >> I have a webserver that takes all
> incoming requests, and I am trying >> to proxy all coldfusion requests to
> another server. >> >> So I have set up a rewrite to catch the requests based
> on filenames >> and proxy them, like so: >> RewriteCond %{REQUEST_FILENAME}
> .*\.cfm|cfc|cfml|jsp|jws$ [NC] >> RewriteRule ^(.*)$
> http://192.168.0.100/$1 [P] >> >> This is configured to apply across many
> virtual hosts, so the proxy >> server needs to know the requested hostname.
> Therefor, I'm also using >> ProxyPreserveHost On in the server config. >> >>
> This is all working splendidly except for directory requests which >> come
> in as /, and where the index file is index.cfm. To catch these >> requests,
> it seems I need to put the rewrite in a .htaccess file. >> However,
> ProxyPreserveHost cannot go in the .htaccess file, and it >> being set to On
> in the main server config is not carrying over to the >> .htaccess file. So
> when the rewrite goes in the .htaccess file, >> requests to / get properly
> proxied, but the proxy server cannot answer >> correctly because the
> requested hostname is lost. >> >> Thoughts?? and Thanks! >> -K >>
> []

Apache users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.