You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Tim Traver <tt...@simplenet.com> on 2005/06/14 21:05:41 UTC

[users@httpd] Forcing External Redirect requests through mod_rewrite and proxy

Hi all,

ok, this may sound wierd, but I'm sure you guys have heard it all...

I am trying to do a proxy redirect using the [P] directive at the end of 
a mod_rewrite rule. Here is what my .htaccess file looks like :

RewriteEngine On
RewriteCond %{REQUEST_URI} !-s
RewriteRule ^page/(.*) http://domain.com/Merchant2/merchant.mvc?page=$1 [P]

What I want to happen is for this proxy request to not be an internal 
one, but make the request externally. The reason for this is because we 
have load balancing switches that determine where requests go based upon 
the URI, and this machine is not supposed to handle the .mvc scripts 
(another bank of machines is)...

So, a request comes in for http://domain.com/page/2 and I want it to 
send out a proxy request to http://domain.com/Merchant2/merchant.mvc?page=2

The reason I do't do a Redirect, is that I do not want the URL to change 
in the users browser...

is there a directive to add to the [P] that can tell it not to do this 
request internally ???

or better yet, is there another module, or resource I can find that I 
can use to accomplish something similar ???

Thanks,

Tim.

---------------------------------------------------------------------
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] Forcing External Redirect requests through mod_rewrite and proxy

Posted by Joshua Slive <js...@gmail.com>.
On 6/14/05, Tim Traver <tt...@simplenet.com> wrote:
> Joshua,
> 
> its doing an internal redirect to the local server. I need it to make an
> external request to that URL and pass through the data it gets back.
> 
> I need it to do that so that it hits the load balancing hardware, and sends
> the request to the server group that can handle the requests for that mime
> type...

This sounds like a networking issue and not an apache issue.  Apache
is simply making an HTTP request to domain.com.  If your OS believes
that domain.com maps to itself, then that is where it will send it. 
You either need to make your OS believe that domain.com maps to your
load balancer, or you need to give apache a different address that
maps correctly.

Joshua.

---------------------------------------------------------------------
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] Forcing External Redirect requests through mod_rewrite and proxy

Posted by Tim Traver <tt...@simplenet.com>.
Joshua,

its doing an internal redirect to the local server. I need it to make an 
external request to that URL and pass through the data it gets back.

I need it to do that so that it hits the load balancing hardware, and 
sends the request to the server group that can handle the requests for 
that mime type...

Tim.


Joshua Slive wrote:

>On 6/14/05, Tim Traver <tt...@simplenet.com> wrote:
>  
>
>>Hi all,
>>
>>ok, this may sound wierd, but I'm sure you guys have heard it all...
>>
>>I am trying to do a proxy redirect using the [P] directive at the end of
>>a mod_rewrite rule. Here is what my .htaccess file looks like :
>>
>>RewriteEngine On
>>RewriteCond %{REQUEST_URI} !-s
>>RewriteRule ^page/(.*) http://domain.com/Merchant2/merchant.mvc?page=$1 [P]
>>
>>What I want to happen is for this proxy request to not be an internal
>>one, but make the request externally. The reason for this is because we
>>have load balancing switches that determine where requests go based upon
>>the URI, and this machine is not supposed to handle the .mvc scripts
>>(another bank of machines is)...
>>
>>So, a request comes in for http://domain.com/page/2 and I want it to
>>send out a proxy request to http://domain.com/Merchant2/merchant.mvc?page=2
>>
>>The reason I do't do a Redirect, is that I do not want the URL to change
>>in the users browser...
>>
>>is there a directive to add to the [P] that can tell it not to do this
>>request internally ???
>>
>>or better yet, is there another module, or resource I can find that I
>>can use to accomplish something similar ???
>>    
>>
>
>I don't understand your question.  What exactly is the above
>configuration not doing that you would like it to do?
>
>Joshua.
>
>---------------------------------------------------------------------
>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] Forcing External Redirect requests through mod_rewrite and proxy

Posted by Joshua Slive <js...@gmail.com>.
On 6/14/05, Tim Traver <tt...@simplenet.com> wrote:
> Hi all,
> 
> ok, this may sound wierd, but I'm sure you guys have heard it all...
> 
> I am trying to do a proxy redirect using the [P] directive at the end of
> a mod_rewrite rule. Here is what my .htaccess file looks like :
> 
> RewriteEngine On
> RewriteCond %{REQUEST_URI} !-s
> RewriteRule ^page/(.*) http://domain.com/Merchant2/merchant.mvc?page=$1 [P]
> 
> What I want to happen is for this proxy request to not be an internal
> one, but make the request externally. The reason for this is because we
> have load balancing switches that determine where requests go based upon
> the URI, and this machine is not supposed to handle the .mvc scripts
> (another bank of machines is)...
> 
> So, a request comes in for http://domain.com/page/2 and I want it to
> send out a proxy request to http://domain.com/Merchant2/merchant.mvc?page=2
> 
> The reason I do't do a Redirect, is that I do not want the URL to change
> in the users browser...
> 
> is there a directive to add to the [P] that can tell it not to do this
> request internally ???
> 
> or better yet, is there another module, or resource I can find that I
> can use to accomplish something similar ???

I don't understand your question.  What exactly is the above
configuration not doing that you would like it to do?

Joshua.

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