Re: Apache proxy based on condition

--0-1100593501-1268682146=:11939
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

Hi All,
=A0=A0 I am configuring a reverse proxy with Apache 2.2 and I need for cert=
ain conditions to make a request to another proxy. These conditions are bas=
ed on some request headers and I can use them directly or mod_setenvif to c=
onfigure a variable based on them.
=A0=A0 For example I would like the following flow:
For request header X-Custom-Type TYPE_1 -> forward to proxy 1For request he=
ader X-Custom-Type TYPE_2 -> forward to proxy 2etc...
=A0=A0I know that there is the directive ProxyRemote in mod_proxy but this =
can be used at most with an url regular expression.
=A0=A0Did anyone managed to set up a flow like this?
Regards,Alin
=0A=0A=0A
--0-1100593501-1268682146=:11939
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

<table cellspacing=3D"0" cellpadding=3D"0" border=3D"0" ><tr><td valign=3D"=
top" style=3D"font: inherit;"><span class=3D"Apple-style-span" style=3D"fon=
t-size: medium; ">Hi All,<div><br></div><div>   I am configuring =
a reverse proxy with Apache 2.2 and I need for certain conditions to make a=
request to another proxy. These conditions are based on some request heade=
rs and I can use them directly or mod_setenvif to configure a variable base=
d on them.</div><div><br></div><div>   For example I would like t=
he following flow:</div><div><br></div><div>For request header X-Custom-Typ=
e TYPE_1 -> forward to proxy 1</div><div>For request header X-Custom-Typ=
e TYPE_2 -> forward to proxy 2</div><div>etc...</div><div><br></div><div=
>  I know that there is the directive ProxyRemote in mod_proxy bu=
t this can be used at most with an url regular expression.</div><div><br></=
div><div>  Did anyone managed to set up a flow like
this?</div><div><br></div><div>Regards,</div><div>Alin</div><div><br></div=
></span></td></tr></table><br>=0A=0A
--0-1100593501-1268682146=:11939--
alin vasile [ Mo, 15 März 2010 20:42 ] [ ID #2035118 ]

Re: Re: Apache proxy based on condition

On 15 Mar 2010, at 19:42, alin vasile wrote:

> Hi All,
>
> I am configuring a reverse proxy with Apache 2.2 and I need for =
certain conditions to make a request to another proxy.

Presumably this other proxy is a forward proxy? If it's a reverse
proxy you don't need to do anything.

> For request header X-Custom-Type TYPE_1 -> forward to proxy 1
> For request header X-Custom-Type TYPE_2 -> forward to proxy 2
> etc...

Use RewriteCond to check the custom header.

> I know that there is the directive ProxyRemote in mod_proxy but this =
can be used at most with an url regular expression.

The trick here is to rewrite into different address spaces with the
relevant ProxyRemote settings.

--
Nick Kew=

------------------------------------------------------------ ---------
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.apache.org
" from the digest: users-digest-unsubscribe [at] httpd.apache.org
For additional commands, e-mail: users-help [at] httpd.apache.org
Nick Kew [ Do, 18 März 2010 09:31 ] [ ID #2035566 ]

Re: Re: Apache proxy based on condition

--0-1830673027-1268908085=:99952
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

I tried this, with no luck.

The good part is that the proxy will be always reverse, so it is easy to ac=
complish only with mod_rewrite.

--- On Thu, 3/18/10, Nick Kew <nick [at] webthing.com> wrote:

From: Nick Kew <nick [at] webthing.com>
Subject: Re: [users [at] httpd] Re: Apache proxy based on condition
To: users [at] httpd.apache.org
Date: Thursday, March 18, 2010, 1:31 AM


On 15 Mar 2010, at 19:42, alin vasile wrote:

> Hi All,
>
>=A0 =A0 I am configuring a reverse proxy with Apache 2.2 and I need for ce=
rtain conditions to make a request to another proxy.

Presumably this other proxy is a forward proxy?=A0 If it's a reverse
proxy you don't need to do anything.

> For request header X-Custom-Type TYPE_1 -> forward to proxy 1
> For request header X-Custom-Type TYPE_2 -> forward to proxy 2
> etc...

Use RewriteCond to check the custom header.

>=A0=A0=A0I know that there is the directive ProxyRemote in mod_proxy but t=
his can be used at most with an url regular expression.

The trick here is to rewrite into different address spaces with the
relevant ProxyRemote settings.

--
Nick Kew
------------------------------------------------------------ ---------
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.apache.org
=A0=A0=A0"=A0=A0=A0from the digest: users-digest-unsubscribe [at] httpd.apache.o=
rg
For additional commands, e-mail: users-help [at] httpd.apache.org

=0A=0A=0A
--0-1830673027-1268908085=:99952
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

<table cellspacing=3D"0" cellpadding=3D"0" border=3D"0" ><tr><td valign=3D"=
top" style=3D"font: inherit;">I tried this, with no luck.<br><br>The good p=
art is that the proxy will be always reverse, so it is easy to accomplish o=
nly with mod_rewrite.<br><br>--- On <b>Thu, 3/18/10, Nick Kew <i><nick [at] w=
ebthing.com></i></b> wrote:<br><blockquote style=3D"border-left: 2px sol=
id rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: Nick K=
ew <nick [at] webthing.com><br>Subject: Re: [users [at] httpd] Re: Apache proxy=
based on condition<br>To: users [at] httpd.apache.org<br>Date: Thursday, March =
18, 2010, 1:31 AM<br><br><div class=3D"plainMail"><br>On 15 Mar 2010, at 19=
:42, alin vasile wrote:<br><br>> Hi All,<br>> <br>>    I=
am configuring a reverse proxy with Apache 2.2 and I need for certain cond=
itions to make a request to another proxy.<br><br>Presumably this other pro=
xy is a forward proxy?  If it's a reverse<br>proxy you don't need to d=
o
anything.<br><br>> For request header X-Custom-Type TYPE_1 -> forwar=
d to proxy 1<br>> For request header X-Custom-Type TYPE_2 -> forward =
to proxy 2<br>> etc...<br><br>Use RewriteCond to check the custom header=
..<br><br>>   I know that there is the directive ProxyRemo=
te in mod_proxy but this can be used at most with an url regular expression=
..<br><br>The trick here is to rewrite into different address spaces with th=
e<br>relevant ProxyRemote settings.<br><br>-- <br>Nick Kew<br>-------------=
--------------------------------------------------------<br>The official Us=
er-To-User support forum of the Apache HTTP Server Project.<br>See <URL:=
<a href=3D"http://httpd.apache.org/userslist.html" target=3D"_blank">http:/=
/httpd.apache.org/userslist.html</a>> for more info.<br>To unsubscribe, =
e-mail: <a ymailto=3D"mailto:users-unsubscribe [at] httpd.apache.org"
href=3D"/mc/compose?to=3Dusers-unsubscribe [at] httpd.apache.org" >users-unsubsc=
ribe [at] httpd.apache.org</a><br>   "   from the =
digest: <a ymailto=3D"mailto:users-digest-unsubscribe [at] httpd.apache.org" hre=
f=3D"/mc/compose?to=3Dusers-digest-unsubscribe [at] httpd.apache. org">users-dige=
st-unsubscribe [at] httpd.apache.org</a><br>For additional commands, e-mail: <a =
ymailto=3D"mailto:users-help [at] httpd.apache.org" href=3D"/mc/compose?to=3Duse=
rs-help [at] httpd.apache.org">users-help [at] httpd.apache.org</a><br><br></div></bl=
ockquote></td></tr></table><br>=0A=0A
--0-1830673027-1268908085=:99952--
alin vasile [ Do, 18 März 2010 11:28 ] [ ID #2035568 ]
Webserver » gmane.comp.apache.user » Re: Apache proxy based on condition

Vorheriges Thema: mod_fcgid question
Nächstes Thema: Exiting process doesn't trigger ErrorDocument 500