Re: Apache proxy based on condition

Re: Apache proxy based on condition

am 15.03.2010 20:42:26 von alin vasile

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

Hi All,
   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.
   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...
  I know that there is the directive ProxyRemote in mod_proxy but this =
can be used at most with an url regular expression.
  Did anyone managed to set up a flow like this?
Regards,Alin
=0A
--0-1100593501-1268682146=:11939
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

top" style=3D"font: inherit;"> t-size: medium; ">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. 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.

   For example I would like t=
he following flow:

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

>  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>
  Did anyone managed to set up a flow like
this?

Regards,
Alin

>


--0-1100593501-1268682146=:11939--

Re: Re: Apache proxy based on condition

am 18.03.2010 09:31:20 von Nick Kew

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

> Hi All,
>=20
> 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.

--=20
Nick Kew=

------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See 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: Re: Apache proxy based on condition

am 18.03.2010 11:28:05 von alin vasile

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

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


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

> Hi All,
>=20
>=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.

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

--=20
Nick Kew
------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
  =A0"  =A0from the digest: users-digest-unsubscribe@httpd.apache.o=
rg
For additional commands, e-mail: users-help@httpd.apache.org

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

top" style=3D"font: inherit;">I tried this, with no luck.

The good p=
art is that the proxy will be always reverse, so it is easy to accomplish o=
nly with mod_rewrite.

--- On Thu, 3/18/10, Nick Kew <nick@w=
ebthing.com>
wrote:
id rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;">
From: Nick K=
ew <nick@webthing.com>
Subject: Re: [users@httpd] Re: Apache proxy=
based on condition
To: users@httpd.apache.org
Date: Thursday, March =
18, 2010, 1:31 AM


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 cond=
itions to make a request to another proxy.

Presumably this other pro=
xy is a forward proxy?  If it's a reverse
proxy you don't need to d=
o
anything.

> For request header X-Custom-Type TYPE_1 -> forwar=
d 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 ProxyRemo=
te 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 th=
e
relevant ProxyRemote settings.

--
Nick Kew
-------------=
--------------------------------------------------------
The official Us=
er-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: href=3D"/mc/compose?to=3Dusers-unsubscribe@httpd.apache.org" >users-unsubsc=
ribe@httpd.apache.org

   "   from the =
digest: f=3D"/mc/compose?to=3Dusers-digest-unsubscribe@httpd.apache. org">users-dige=
st-unsubscribe@httpd.apache.org

For additional commands, e-mail: ymailto=3D"mailto:users-help@httpd.apache.org" href=3D"/mc/compose?to=3Duse=
rs-help@httpd.apache.org">users-help@httpd.apache.org


ockquote>


--0-1830673027-1268908085=:99952--