You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Chris Arnold <ca...@electrichendrix.com> on 2012/07/03 23:25:34 UTC

[users@httpd] Rewrite Rule Help (again)

Hello list! Apache 2.2.12 on SLES 11 SP2. I need to rewrite/proxy http://updates.domain.com traffic to another server on the LAN. I have a few rewrite rules in my host file now:
RewriteRule ^/folder http://%{HTTP_HOST}/folder/ [L]

but am not sure how to rewrite without a folder (ie http://updates.domain.com to another server with the same address).

The deal is we only have 1 public ip and the router PATs port 80 traffic to the SLES11 server and for http://updates.domain.com needs to go to a different server. Can i do this with apache2 and with a rewrite?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Rewrite Rule Help (again)

Posted by Eric Covener <co...@gmail.com>.
On Tue, Jul 3, 2012 at 5:45 PM, Chris Arnold
<ca...@electrichendrix.com> wrote:
>>That's the same as if it ended with a slash, and matched by ^/$
>
> So, RewriteRule ^/$ http://192.168.123.2/ will send just http://updates.domain.com to 192.168.123.2? I don't want all http traffic to go to that server, just http://updates.domain.com.
>

Check %{HTTP_HOST} with a rewritecond or put it in a context (non
default name-based vhost) that only matches the desired hostname.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Rewrite Rule Help (again)

Posted by Perry Smith <pe...@gmail.com>.
On Jul 10, 2012, at 6:11 PM, Chris Arnold wrote:

> Am I not asking the right question? Have I not given enough information? Or am I missing something?
> 
> Sent from my iPhone
> 
> On Jul 10, 2012, at 1:27 PM, Chris Arnold <ca...@electrichendrix.com> wrote:
> 
>> Anybody got any ideas?
>> 
>> Sent from my iPhone
>> 
>> On Jul 9, 2012, at 7:24 PM, Chris Arnold <ca...@electrichendrix.com> wrote:
>> 
>>> On Jul 9, 2012, at 6:28 PM, Daniel Ruggeri <DR...@primary.net> wrote:
>>> 
>>>> On 7/9/2012 5:03 PM, Chris Arnold wrote:
>>>>> So the RewriteRule ^/$ http://192.168.123.2 [L] 
>>>>> Sends all traffic to 192.168.123.2. I just need http://update.domain.com traffic to go to the 192.168.123.2 host.
>>>> 
>>>> Chris;
>>>>    I think more information is needed... how do clients get to "update.domain.com" and the rest of your domains?
>>> 
>>> Not really sure what you mean but clients get to update.domain.com from the Internet and the intranet (intranet is through a VPN. Internet is over http. We have a public dns entry and a private dns entry). When the request hits our firewall, the firewall sends all port (in this instance) 80 request to the apache server and I need apache to send update.domain.com to a different LAN server (running iis 7.5).
>>> I hope this answered your question?
>>> 
>>>> You may be able to use a condition like so:
>>>> RewriteCond %{HTTP_HOST} update.domain.com
>>>> RewriteRule ^/$ http://192.168.123.2 [L] 
>>> 
>>> I tried this and when going to update.domain.com, I get the default site from the apache server.


I'm sorta of a newbie here so I feel a little timid.  But I don't have a clue what the symptoms are.  What is "the default site"?  What do you want to happen verses what is actually happening?


RE: [users@httpd] Rewrite Rule Help (again)

Posted by Brian Gaber <Br...@tpsgc-pwgsc.gc.ca>.
Does your problem have anything to do with this statement found in http://httpd.apache.org/docs/trunk/rewrite/remapping.html

mod_rewrite evaluates the left-hand-side of the RewriteRule before it evaluates the RewriteCond directives. 

-----Original Message-----
From: Chris Arnold [mailto:carnold@electrichendrix.com] 
Sent: Tuesday, July 10, 2012 10:20 PM
To: users@httpd.apache.org
Subject: Re: [users@httpd] Rewrite Rule Help (again)

In the event anyone comes across this, i got this to work using the following:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^update.domain.com$ [NC] RewriteRule ^/$ http://private.ip.address [R,L]


----- Original Message -----
From: "Chris Arnold" <ca...@electrichendrix.com>
To: users@httpd.apache.org
Sent: Tuesday, July 10, 2012 9:37:30 PM
Subject: Re: [users@httpd] Rewrite Rule Help (again)

>You've been already given the answer by Eric what else do you need? Read mod_rewrite manual and combine RewriteCond and RewriteRule >commands thats all you need to do. 

Igor,i have read the rewrite guide and tried what i thought was needed. Which i have repeated here more than 1 time but this time i will show what i tried from the guide:
Move Homedirs to Different Webserver
Description:
Many webmasters have asked for a solution to the following situation: They wanted to redirect just all homedirs on a webserver to another webserver. They usually need such things when establishing a newer webserver which will replace the old one over time.

Solution:
The solution is trivial with mod_rewrite. On the old webserver we just redirect all /~user/anypath URLs to http://newserver/~user/anypath.

RewriteEngine on
RewriteRule   ^/~(.+)  http://newserver/~$1  [R,L]

And here is how i have altered it to fit what i need:
RewriteRule ^/$ http://192.168.123.2/ [L] This just leaves me at the webserver. I have also tried what others have suggested here and replied with the results.

BTW, the solution Igor is referring to, does anyone have that email and can post it (send it to me) as i seem to have lost that email.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Rewrite Rule Help (again)

Posted by Igor Cicimov <ic...@gmail.com>.
On Wed, Jul 11, 2012 at 1:22 PM, Chris Arnold
<ca...@electrichendrix.com>wrote:

> >You may need to change the R to a P:
>
> >RewriteEngine On
> >RewriteCond %{HTTP_HOST} !^update.domain.com$ [NC]
> >RewriteRule ^/$ http://private.ip.address/ [P,L]
>
> This sends all http traffic to the private ip server
>
> >This turns the rule into a proxy to that private IP, assuming that is
> >what you are trying to accomplish.
>
> I am not sure what the "technical" name is of what i am trying to do. The
> lines between rewrite and proxy are blurred to say the least. That is why i
> have tried to give an accurate description of what i am trying to do.
>
>
> >Finally, if you want URLS other than the root to be proxied, you may
> >need to capture the URI like so:
>
> >RewriteEngine On
> >RewriteCond %{HTTP_HOST} !^update.domain.com$ [NC]
> >RewriteRule ^/(.*)$ http://private.ip.address/$1 [P,L]
>
> Because the first suggestion did not work, i tried this one and it sends
> all http traffic to the iis server too.
> Just to maybe giv a better account of what i am trying to do. We have a
> webserver (say webserv A) that fulfills http port 80 requests and uses
> apache. We have another webserver that runs a program that requires it to
> run on 80 and uses iis. We have 1 public ip, with public dns entries for a
> number of hostnames and matching private dns entries. The firewall sends
> all port 80 traffic to the apache server. We need only updates.domain.com(this will come to the apache server) to be redirected/proxied to the iis
> server. We need the other websites, domain.com and the other
> domain.com/folder sites to still be served on the apache server. Here is
> the first part of the vhost file:
> <VirtualHost *:80>
>     ServerAdmin email@domain.com
>     ServerName domain.net
>     ServerAlias www.domain.net
>
>     #SSLProxyEngine On
>     #ProxyPass /ifolder/ https://192.168.123.4/ifolder/
>     #ProxyPassReverse /ifolder/ https://192.168.123.4/ifolder/
>     RewriteEngine On
>     RewriteRule ^/ifolder(.*) https://%{HTTP_HOST}/ifolder/ [L]
>     RewriteRule ^/admin(.*) https://%{HTTP_HOST}/admin/ [L]
>     RewriteCond %{HTTP_HOST} !^updates.domain.net$ [NC]
>     RewriteRule ^/(.*)$ http://192.168.123.2/$1 [P,L]
>
>
> I hoped this clears up some stuff up and makes it clear what i need apache
> to do.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
Your configuration doesn't make sense. When requests for
updates.domain.netcome apache will look in the VirtualHost
configurations and try to find the
one that matches the server name ie ServerName updates.domain.net. In your
case virtual host like that doesn't exists. Putting the redirects inside
virtual host named domain.net WILL NOT work from the reason I just
explained, that virtual host will never receive those requests.

So, you have two options:

1. Create new virtual host with ServerName updates.domain.net
2. Put the redirect lines OUTSIDE the wrong virtual host ie in the
httpd.conf file so they get caught by the server when none of the hosts
match the request HTTP_HOST

which was exactly what Eric Covener suggested on 4 of July:

Check %{HTTP_HOST} with a rewritecond or put it in a context (non
> default name-based vhost) that only matches the desired hostname.


but you didn't understand it obviously.

Cheers,
Igor

Re: [users@httpd] Rewrite Rule Help (again)

Posted by Eric Covener <co...@gmail.com>.
> <VirtualHost *:80>
>     ServerAdmin email@domain.com
>     ServerName domain.net
>     ServerAlias www.domain.net
>
>     #SSLProxyEngine On
>     #ProxyPass /ifolder/ https://192.168.123.4/ifolder/
>     #ProxyPassReverse /ifolder/ https://192.168.123.4/ifolder/
>     RewriteEngine On
>     RewriteRule ^/ifolder(.*) https://%{HTTP_HOST}/ifolder/ [L]
>     RewriteRule ^/admin(.*) https://%{HTTP_HOST}/admin/ [L]
>     RewriteCond %{HTTP_HOST} !^updates.domain.net$ [NC]
>     RewriteRule ^/(.*)$ http://192.168.123.2/$1 [P,L]

Is updates.domain.net negated here on purpose?
Do requests to updates.domain.net even hit this virtualhost (ServerAlias)

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Rewrite Rule Help (again)

Posted by Chris Arnold <ca...@electrichendrix.com>.
>You may need to change the R to a P:

>RewriteEngine On
>RewriteCond %{HTTP_HOST} !^update.domain.com$ [NC]
>RewriteRule ^/$ http://private.ip.address/ [P,L]

This sends all http traffic to the private ip server

>This turns the rule into a proxy to that private IP, assuming that is
>what you are trying to accomplish.

I am not sure what the "technical" name is of what i am trying to do. The lines between rewrite and proxy are blurred to say the least. That is why i have tried to give an accurate description of what i am trying to do.


>Finally, if you want URLS other than the root to be proxied, you may
>need to capture the URI like so:

>RewriteEngine On
>RewriteCond %{HTTP_HOST} !^update.domain.com$ [NC]
>RewriteRule ^/(.*)$ http://private.ip.address/$1 [P,L]

Because the first suggestion did not work, i tried this one and it sends all http traffic to the iis server too.
Just to maybe giv a better account of what i am trying to do. We have a webserver (say webserv A) that fulfills http port 80 requests and uses apache. We have another webserver that runs a program that requires it to run on 80 and uses iis. We have 1 public ip, with public dns entries for a number of hostnames and matching private dns entries. The firewall sends all port 80 traffic to the apache server. We need only updates.domain.com (this will come to the apache server) to be redirected/proxied to the iis server. We need the other websites, domain.com and the other domain.com/folder sites to still be served on the apache server. Here is the first part of the vhost file:
<VirtualHost *:80>
    ServerAdmin email@domain.com
    ServerName domain.net
    ServerAlias www.domain.net

    #SSLProxyEngine On
    #ProxyPass /ifolder/ https://192.168.123.4/ifolder/
    #ProxyPassReverse /ifolder/ https://192.168.123.4/ifolder/
    RewriteEngine On
    RewriteRule ^/ifolder(.*) https://%{HTTP_HOST}/ifolder/ [L]
    RewriteRule ^/admin(.*) https://%{HTTP_HOST}/admin/ [L]
    RewriteCond %{HTTP_HOST} !^updates.domain.net$ [NC]
    RewriteRule ^/(.*)$ http://192.168.123.2/$1 [P,L]


I hoped this clears up some stuff up and makes it clear what i need apache to do.



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Rewrite Rule Help (again)

Posted by Daniel Ruggeri <DR...@primary.net>.
On 7/10/2012 9:32 PM, Chris Arnold wrote:
> RewriteEngine On
> > RewriteCond %{HTTP_HOST} !^update.domain.com$ [NC]
> > RewriteRule ^/$ http://private.ip.address [R,L]

You may need to change the R to a P:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^update.domain.com$ [NC]
RewriteRule ^/$ http://private.ip.address/ [P,L]

This turns the rule into a proxy to that private IP, assuming that is
what you are trying to accomplish. Also, be sure to match slashes on
your rule.


Finally, if you want URLS other than the root to be proxied, you may
need to capture the URI like so:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^update.domain.com$ [NC]
RewriteRule ^/(.*)$ http://private.ip.address/$1 [P,L]



-- 
Daniel Ruggeri


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Rewrite Rule Help (again)

Posted by Chris Arnold <ca...@electrichendrix.com>.
I spoke too early!! Again, all http traffic is being directed to the private ip of the iis server. I would love to get some help with this.

Sent from my iPhone

On Jul 10, 2012, at 10:19 PM, Chris Arnold <ca...@electrichendrix.com> wrote:

> In the event anyone comes across this, i got this to work using the following:
> RewriteEngine On
> RewriteCond %{HTTP_HOST} !^update.domain.com$ [NC]
> RewriteRule ^/$ http://private.ip.address [R,L]
> 
> 
> ----- Original Message -----
> From: "Chris Arnold" <ca...@electrichendrix.com>
> To: users@httpd.apache.org
> Sent: Tuesday, July 10, 2012 9:37:30 PM
> Subject: Re: [users@httpd] Rewrite Rule Help (again)
> 
>> You've been already given the answer by Eric what else do you need? Read mod_rewrite manual and combine RewriteCond and RewriteRule >commands thats all you need to do. 
> 
> Igor,i have read the rewrite guide and tried what i thought was needed. Which i have repeated here more than 1 time but this time i will show what i tried from the guide:
> Move Homedirs to Different Webserver
> Description:
> Many webmasters have asked for a solution to the following situation: They wanted to redirect just all homedirs on a webserver to another webserver. They usually need such things when establishing a newer webserver which will replace the old one over time.
> 
> Solution:
> The solution is trivial with mod_rewrite. On the old webserver we just redirect all /~user/anypath URLs to http://newserver/~user/anypath.
> 
> RewriteEngine on
> RewriteRule   ^/~(.+)  http://newserver/~$1  [R,L]
> 
> And here is how i have altered it to fit what i need:
> RewriteRule ^/$ http://192.168.123.2/ [L]
> This just leaves me at the webserver. I have also tried what others have suggested here and replied with the results.
> 
> BTW, the solution Igor is referring to, does anyone have that email and can post it (send it to me) as i seem to have lost that email.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Rewrite Rule Help (again)

Posted by Chris Arnold <ca...@electrichendrix.com>.
In the event anyone comes across this, i got this to work using the following:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^update.domain.com$ [NC]
RewriteRule ^/$ http://private.ip.address [R,L]


----- Original Message -----
From: "Chris Arnold" <ca...@electrichendrix.com>
To: users@httpd.apache.org
Sent: Tuesday, July 10, 2012 9:37:30 PM
Subject: Re: [users@httpd] Rewrite Rule Help (again)

>You've been already given the answer by Eric what else do you need? Read mod_rewrite manual and combine RewriteCond and RewriteRule >commands thats all you need to do. 

Igor,i have read the rewrite guide and tried what i thought was needed. Which i have repeated here more than 1 time but this time i will show what i tried from the guide:
Move Homedirs to Different Webserver
Description:
Many webmasters have asked for a solution to the following situation: They wanted to redirect just all homedirs on a webserver to another webserver. They usually need such things when establishing a newer webserver which will replace the old one over time.

Solution:
The solution is trivial with mod_rewrite. On the old webserver we just redirect all /~user/anypath URLs to http://newserver/~user/anypath.

RewriteEngine on
RewriteRule   ^/~(.+)  http://newserver/~$1  [R,L]

And here is how i have altered it to fit what i need:
RewriteRule ^/$ http://192.168.123.2/ [L]
This just leaves me at the webserver. I have also tried what others have suggested here and replied with the results.

BTW, the solution Igor is referring to, does anyone have that email and can post it (send it to me) as i seem to have lost that email.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Rewrite Rule Help (again)

Posted by Chris Arnold <ca...@electrichendrix.com>.
>You've been already given the answer by Eric what else do you need? Read mod_rewrite manual and combine RewriteCond and RewriteRule >commands thats all you need to do. 

Igor,i have read the rewrite guide and tried what i thought was needed. Which i have repeated here more than 1 time but this time i will show what i tried from the guide:
Move Homedirs to Different Webserver
Description:
Many webmasters have asked for a solution to the following situation: They wanted to redirect just all homedirs on a webserver to another webserver. They usually need such things when establishing a newer webserver which will replace the old one over time.

Solution:
The solution is trivial with mod_rewrite. On the old webserver we just redirect all /~user/anypath URLs to http://newserver/~user/anypath.

RewriteEngine on
RewriteRule   ^/~(.+)  http://newserver/~$1  [R,L]

And here is how i have altered it to fit what i need:
RewriteRule ^/$ http://192.168.123.2/ [L]
This just leaves me at the webserver. I have also tried what others have suggested here and replied with the results.

BTW, the solution Igor is referring to, does anyone have that email and can post it (send it to me) as i seem to have lost that email.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Rewrite Rule Help (again)

Posted by Igor Cicimov <ic...@gmail.com>.
You've been already given the answer by Eric what else do you need? Read
mod_rewrite manual and combine RewriteCond and RewriteRule commands thats
all you need to do.
 On Jul 11, 2012 9:12 AM, "Chris Arnold" <ca...@electrichendrix.com>
wrote:

> Am I not asking the right question? Have I not given enough information?
> Or am I missing something?
>
> Sent from my iPhone
>
> On Jul 10, 2012, at 1:27 PM, Chris Arnold <ca...@electrichendrix.com>
> wrote:
>
> Anybody got any ideas?
>
> Sent from my iPhone
>
> On Jul 9, 2012, at 7:24 PM, Chris Arnold <ca...@electrichendrix.com>
> wrote:
>
> On Jul 9, 2012, at 6:28 PM, Daniel Ruggeri <DR...@primary.net> wrote:
>
> On 7/9/2012 5:03 PM, Chris Arnold wrote:
>
> So the RewriteRule ^/$ http://192.168.123.2 [L]
> Sends all traffic to 192.168.123.2. I just need http://update.domain.comtraffic to go to the 192.168.123.2 host.
>
>
> Chris;
>    I think more information is needed... how do clients get to "
> update.domain.com" and the rest of your domains?
>
>
> Not really sure what you mean but clients get to update.domain.com from
> the Internet and the intranet (intranet is through a VPN. Internet is over
> http. We have a public dns entry and a private dns entry). When the request
> hits our firewall, the firewall sends all port (in this instance) 80
> request to the apache server and I need apache to send update.domain.comto a different LAN server (running iis 7.5).
> I hope this answered your question?
>
> You may be able to use a condition like so:
> RewriteCond %{HTTP_HOST} update.domain.com
> RewriteRule ^/$ http://192.168.123.2 [L]
>
>
> I tried this and when going to update.domain.com, I get the default site
> from the apache server.
>
>

Re: [users@httpd] Rewrite Rule Help (again)

Posted by Chris Arnold <ca...@electrichendrix.com>.
Am I not asking the right question? Have I not given enough information? Or am I missing something?

Sent from my iPhone

On Jul 10, 2012, at 1:27 PM, Chris Arnold <ca...@electrichendrix.com> wrote:

> Anybody got any ideas?
> 
> Sent from my iPhone
> 
> On Jul 9, 2012, at 7:24 PM, Chris Arnold <ca...@electrichendrix.com> wrote:
> 
>> On Jul 9, 2012, at 6:28 PM, Daniel Ruggeri <DR...@primary.net> wrote:
>> 
>>> On 7/9/2012 5:03 PM, Chris Arnold       wrote:
>>>> So the RewriteRule ^/$ http://192.168.123.2 [L] 
>>>> Sends all traffic to 192.168.123.2. I just need http://update.domain.com traffic to go to the 192.168.123.2 host.
>>> 
>>> Chris;
>>>    I think more information is needed... how do clients get to "update.domain.com" and the rest of your domains?
>> 
>> Not really sure what you mean but clients get to update.domain.com from the Internet and the intranet (intranet is through a VPN. Internet is over http. We have a public dns entry and a private dns entry). When the request hits our firewall, the firewall sends all port (in this instance) 80 request to the apache server and I need apache to send update.domain.com to a different LAN server (running iis 7.5).
>> I hope this answered your question?
>> 
>>> You may be able to use a condition like so:
>>> RewriteCond %{HTTP_HOST} update.domain.com
>>> RewriteRule ^/$ http://192.168.123.2 [L] 
>> 
>> I tried this and when going to update.domain.com, I get the default site from the apache server.

Re: [users@httpd] Rewrite Rule Help (again)

Posted by Chris Arnold <ca...@electrichendrix.com>.
Anybody got any ideas?

Sent from my iPhone

On Jul 9, 2012, at 7:24 PM, Chris Arnold <ca...@electrichendrix.com> wrote:

> On Jul 9, 2012, at 6:28 PM, Daniel Ruggeri <DR...@primary.net> wrote:
> 
>> On 7/9/2012 5:03 PM, Chris Arnold wrote:
>>> So the RewriteRule ^/$ http://192.168.123.2 [L] 
>>> Sends all traffic to 192.168.123.2. I just need http://update.domain.com           traffic to go to the 192.168.123.2 host.
>> 
>> Chris;
>>    I think more information is needed... how do clients get to "update.domain.com" and the rest of your domains?
> 
> Not really sure what you mean but clients get to update.domain.com from the Internet and the intranet (intranet is through a VPN. Internet is over http. We have a public dns entry and a private dns entry). When the request hits our firewall, the firewall sends all port (in this instance) 80 request to the apache server and I need apache to send update.domain.com to a different LAN server (running iis 7.5).
> I hope this answered your question?
> 
>> You may be able to use a condition like so:
>> RewriteCond %{HTTP_HOST} update.domain.com
>> RewriteRule ^/$ http://192.168.123.2       [L] 
> 
> I tried this and when going to update.domain.com, I get the default site from the apache server.

Re: [users@httpd] Rewrite Rule Help (again)

Posted by Chris Arnold <ca...@electrichendrix.com>.
On Jul 9, 2012, at 6:28 PM, Daniel Ruggeri <DR...@primary.net> wrote:

> On 7/9/2012 5:03 PM, Chris Arnold wrote:
>> So the RewriteRule ^/$ http://192.168.123.2 [L] 
>> Sends all traffic to 192.168.123.2. I just need http://update.domain.com traffic to go to the 192.168.123.2 host.
> 
> Chris;
>    I think more information is needed... how do clients get to "update.domain.com" and the rest of your domains?

Not really sure what you mean but clients get to update.domain.com from the Internet and the intranet (intranet is through a VPN. Internet is over http. We have a public dns entry and a private dns entry). When the request hits our firewall, the firewall sends all port (in this instance) 80 request to the apache server and I need apache to send update.domain.com to a different LAN server (running iis 7.5).
I hope this answered your question?

> You may be able to use a condition like so:
> RewriteCond %{HTTP_HOST} update.domain.com
> RewriteRule ^/$ http://192.168.123.2 [L] 

I tried this and when going to update.domain.com, I get the default site from the apache server.

Re: [users@httpd] Rewrite Rule Help (again)

Posted by Daniel Ruggeri <DR...@primary.net>.
On 7/9/2012 5:03 PM, Chris Arnold wrote:
> So the RewriteRule ^/$ http://192.168.123.2 [L] 
> Sends all traffic to 192.168.123.2. I just need
> http://update.domain.com traffic to go to the 192.168.123.2 host.

Chris;
   I think more information is needed... how do clients get to
"update.domain.com" and the rest of your domains? You may be able to use
a condition like so:
RewriteCond %{HTTP_HOST} update.domain.com
RewriteRule ^/$ http://192.168.123.2 [L]

... to ensure only things matching that domain name get sent there once
they reach httpd... that is a shot in the dark without more information.

-- 
Daniel Ruggeri


Re: [users@httpd] Rewrite Rule Help (again)

Posted by Chris Arnold <ca...@electrichendrix.com>.
Anybody got any ideas?

Sent from my iPhone

On Jul 8, 2012, at 9:30 PM, Chris Arnold <ca...@electrichendrix.com> wrote:

> So the RewriteRule ^/$ http://192.168.123.2 [L] 
> Sends all traffic to 192.168.123.2. I just need http://update.domain.com traffic to go to the 192.168.123.2 host.
> 
> 
> 
> On Jul 7, 2012, at 11:50 AM, Chris Arnold <ca...@electrichendrix.com> wrote:
> 
>> On Jul 7, 2012, at 10:54 AM, Chris Arnold <ca...@electrichendrix.com> wrote:
>> 
>>>>> That's the same as if it ended with a slash, and matched by ^/$
>>> 
>>> Ok my host file has RewriteRule ^/$ http://update.domain.com [L]
>>> When I goto http://update.domain.com using safari, I receive:
>>> Response Error.
>>> 
>>> Technical description:
>>> 502 Bad Gateway - Response Error, a bad response was received from another proxy server or the destination origin server.
>>> 
>> This was because the webserver was not running. Reboot and it is running now. Now when going to http://update.domain.com I get the default site from the webserver. I have tried RewriteRule ^/$ http://host name [L] and RewriteRule ^/$ http://ip.address [L]
>> Both send me to the default site. Any ideas?
>>> So, a quick revisit: we have a web server answering for http traffic. We have a different server that uses a program that HAS to use http (80) port. I am trying to get the webserver to send http://update.domain.com traffic only, to a different server on the LAN. Any ideas?

Re: [users@httpd] Rewrite Rule Help (again)

Posted by Chris Arnold <ca...@electrichendrix.com>.
So the RewriteRule ^/$ http://192.168.123.2 [L] 
Sends all traffic to 192.168.123.2. I just need http://update.domain.com traffic to go to the 192.168.123.2 host.



On Jul 7, 2012, at 11:50 AM, Chris Arnold <ca...@electrichendrix.com> wrote:

> On Jul 7, 2012, at 10:54 AM, Chris Arnold <ca...@electrichendrix.com> wrote:
> 
>>>> That's the same as if it ended with a slash, and matched by ^/$
>> 
>> Ok my host file has RewriteRule ^/$ http://update.domain.com [L]
>> When I goto http://update.domain.com using safari, I receive:
>> Response Error.
>> 
>> Technical description:
>> 502 Bad Gateway - Response Error, a bad response was received from another proxy server or the destination origin server.
>> 
> This was because the webserver was not running. Reboot and it is running now. Now when going to http://update.domain.com I get the default site from the webserver. I have tried RewriteRule ^/$ http://host name [L] and RewriteRule ^/$ http://ip.address [L]
> Both send me to the default site. Any ideas?
>> So, a quick revisit: we have a web server answering for http traffic. We have a different server that uses a program that HAS to use http (80) port. I am trying to get the webserver to send http://update.domain.com traffic only, to a different server on the LAN. Any ideas?

Re: [users@httpd] Rewrite Rule Help (again)

Posted by Chris Arnold <ca...@electrichendrix.com>.
On Jul 7, 2012, at 10:54 AM, Chris Arnold <ca...@electrichendrix.com> wrote:

>>> That's the same as if it ended with a slash, and matched by ^/$
> 
> Ok my host file has RewriteRule ^/$ http://update.domain.com [L]
> When I goto http://update.domain.com using safari, I receive:
> Response Error.
> 
> Technical description:
> 502 Bad Gateway - Response Error, a bad response was received from another proxy server or the destination origin server.
> 
This was because the webserver was not running. Reboot and it is running now. Now when going to http://update.domain.com I get the default site from the webserver. I have tried RewriteRule ^/$ http://host name [L] and RewriteRule ^/$ http://ip.address [L]
Both send me to the default site. Any ideas?
> So, a quick revisit: we have a web server answering for http traffic. We have a different server that uses a program that HAS to use http (80) port. I am trying to get the webserver to send http://update.domain.com traffic only, to a different server on the LAN. Any ideas?

Re: [users@httpd] Rewrite Rule Help (again)

Posted by Chris Arnold <ca...@electrichendrix.com>.
>> That's the same as if it ended with a slash, and matched by ^/$

Ok my host file has RewriteRule ^/$ http://update.domain.com [L]
When I goto http://update.domain.com using safari, I receive:
Response Error.

Technical description:
502 Bad Gateway - Response Error, a bad response was received from another proxy server or the destination origin server.

So, a quick revisit: we have a web server answering for http traffic. We have a different server that uses a program that HAS to use http (80) port. I am trying to get the webserver to send http://update.domain.com traffic only, to a different server on the LAN. Any ideas?

Re: [users@httpd] Rewrite Rule Help (again)

Posted by Chris Arnold <ca...@electrichendrix.com>.
>That's the same as if it ended with a slash, and matched by ^/$

So, RewriteRule ^/$ http://192.168.123.2/ will send just http://updates.domain.com to 192.168.123.2? I don't want all http traffic to go to that server, just http://updates.domain.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Rewrite Rule Help (again)

Posted by Eric Covener <co...@gmail.com>.
> but am not sure how to rewrite without a folder (ie http://updates.domain.com to another server with the same address).

That's the same as if it ended with a slash, and matched by ^/$

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org