Problems with proxying remote URLs

Problems with proxying remote URLs

am 28.08.2005 22:32:34 von Alexander Prohorenko

Hello,

I've got problem with using a mod_rewrite module using [P] keyword to
proxy a request. Everything works just fine with local files and
redirects, but when I'm trying to use a redirect with proxy to remote
destination I'm getting something like:

[Sun Aug 28 14:05:36 2005] [error] [client 1.2.1.2] File does not exist:
proxy:http://my.domain.com/zzz

My config reads like (in .htaccess):

RewriteEngine On
RewriteRule ^(.*) http://my.domain.com/$1 [P]

When I am removing the [P] keyword and it tries to do a redirect it
works fine.

Would you advise me please something? Thanks.

Please, drop me a Cc to my mail address, as far as I'm not regulary
reading this newsgroups. Thanks.

P.S. Apache 1.3.33 built from ports on FreeBSD 5.4-STABLE. I've got
completely the same configuration on Apache 1.3.29 and it works just fine.


------------------------------------------------------------ ---------
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: Problems with proxying remote URLs

am 29.08.2005 01:13:19 von Joshua Slive

On 8/28/05, Alexander Prohorenko wrote:
> Hello,
>=20
> I've got problem with using a mod_rewrite module using [P] keyword to
> proxy a request. Everything works just fine with local files and
> redirects, but when I'm trying to use a redirect with proxy to remote
> destination I'm getting something like:
>=20
> [Sun Aug 28 14:05:36 2005] [error] [client 1.2.1.2] File does not exist:
> proxy:http://my.domain.com/zzz

Check that you have mod_proxy loaded statically (httpd -l) or
dynamically (via LoadModule).

Joshua.

------------------------------------------------------------ ---------
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: Problems with proxying remote URLs

am 29.08.2005 07:41:29 von Alexander Prohorenko

Joshua Slive wrote:
> On 8/28/05, Alexander Prohorenko wrote:

>>I've got problem with using a mod_rewrite module using [P] keyword to
>>proxy a request. Everything works just fine with local files and
>>redirects, but when I'm trying to use a redirect with proxy to remote
>>destination I'm getting something like:
>>
>>[Sun Aug 28 14:05:36 2005] [error] [client 1.2.1.2] File does not exist:
>>proxy:http://my.domain.com/zzz
>
>
> Check that you have mod_proxy loaded statically (httpd -l) or
> dynamically (via LoadModule).

Of course it's loaded.

white@artiste:/usr/local/etc/apache>grep proxy httpd.conf

LoadModule proxy_module libexec/apache/libproxy.so
AddModule mod_proxy.c

If it'd not be loaded, how would the usual proxying of local files work?


------------------------------------------------------------ ---------
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: Problems with proxying remote URLs

am 29.08.2005 10:23:13 von Axel-Stephane.SMORGRAV

No reason to get cranky there.=20

My first thought also was that you are missing a proxy module. I =
understand you are using Apache 1.3. What about the order in which the =
modules are loaded? Could you try to rearrange them by putting the =
AddModule statement either at the top or the bottom of the list of =
modules, or at least before or after the rewrite module ?

If memory serves me right, the modules added last are the ones executed =
first. You want mod_proxy to be executed after mod_rewrite so =
mod_rewrite must be loaded after mod_proxy.

-ascs

-----Original Message-----
From: news [mailto:news@sea.gmane.org] On Behalf Of Alexander Prohorenko
Sent: Monday, August 29, 2005 7:41 AM
To: users@httpd.apache.org
Subject: [users@httpd] Re: Problems with proxying remote URLs

Joshua Slive wrote:
> On 8/28/05, Alexander Prohorenko =
wrote:

>>I've got problem with using a mod_rewrite module using [P] keyword to=20
>>proxy a request. Everything works just fine with local files and=20
>>redirects, but when I'm trying to use a redirect with proxy to remote=20
>>destination I'm getting something like:
>>
>>[Sun Aug 28 14:05:36 2005] [error] [client 1.2.1.2] File does not =
exist:
>>proxy:http://my.domain.com/zzz
>=20
>=20
> Check that you have mod_proxy loaded statically (httpd -l) or=20
> dynamically (via LoadModule).

Of course it's loaded.

white@artiste:/usr/local/etc/apache>grep proxy httpd.conf

LoadModule proxy_module libexec/apache/libproxy.so
AddModule mod_proxy.c

If it'd not be loaded, how would the usual proxying of local files work?

------------------------------------------------------------ ---------
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: Problems with proxying remote URLs

am 29.08.2005 10:55:01 von jerome.tytgat

> If memory serves me right, the modules added last are the ones executed first.
> You want mod_proxy to be executed after mod_rewrite so mod_rewrite must be loaded after mod_proxy.

Interesting point, I was facing that kind of problem when I wanted to do rewrite rules plus
proxypass.

What about Apache2 ?

How do you define the order when you use mods-enabled directory ?

By changing the name order ? (mod_proxy come first in directory listing)

Jerome.

------------------------------------------------------------ ---------
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: Problems with proxying remote URLs

am 29.08.2005 11:37:42 von Alexander Prohorenko

Thanks for advice, but no luck here. I've tried the both variants
(mod_proxy before and mod_proxy after mod_rewrite), but nothing changed.

Axel-Stéphane SMORGRAV wrote:
> No reason to get cranky there.
>
> My first thought also was that you are missing a proxy module. I understand you are using Apache 1.3. What about the order in which the modules are loaded? Could you try to rearrange them by putting the AddModule statement either at the top or the bottom of the list of modules, or at least before or after the rewrite module ?
>
> If memory serves me right, the modules added last are the ones executed first. You want mod_proxy to be executed after mod_rewrite so mod_rewrite must be loaded after mod_proxy.
>
> -ascs
>
> -----Original Message-----
> From: news [mailto:news@sea.gmane.org] On Behalf Of Alexander Prohorenko
> Sent: Monday, August 29, 2005 7:41 AM
> To: users@httpd.apache.org
> Subject: [users@httpd] Re: Problems with proxying remote URLs
>
> Joshua Slive wrote:
>
>>On 8/28/05, Alexander Prohorenko wrote:
>
>
>>>I've got problem with using a mod_rewrite module using [P] keyword to
>>>proxy a request. Everything works just fine with local files and
>>>redirects, but when I'm trying to use a redirect with proxy to remote
>>>destination I'm getting something like:
>>>
>>>[Sun Aug 28 14:05:36 2005] [error] [client 1.2.1.2] File does not exist:
>>>proxy:http://my.domain.com/zzz
>>
>>
>>Check that you have mod_proxy loaded statically (httpd -l) or
>>dynamically (via LoadModule).
>
>
> Of course it's loaded.
>
> white@artiste:/usr/local/etc/apache>grep proxy httpd.conf
>
> LoadModule proxy_module libexec/apache/libproxy.so
> AddModule mod_proxy.c
>
> If it'd not be loaded, how would the usual proxying of local files work?
>


------------------------------------------------------------ ---------
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: Problems with proxying remote URLs

am 29.08.2005 12:08:02 von Alexander Prohorenko

The problem was solved by building Apache from ports without mod_accel.

Alexander Prohorenko wrote:
> Hello,
>
> I've got problem with using a mod_rewrite module using [P] keyword to
> proxy a request. Everything works just fine with local files and
> redirects, but when I'm trying to use a redirect with proxy to remote
> destination I'm getting something like:
>
> [Sun Aug 28 14:05:36 2005] [error] [client 1.2.1.2] File does not exist:
> proxy:http://my.domain.com/zzz
>
> My config reads like (in .htaccess):
>
> RewriteEngine On
> RewriteRule ^(.*) http://my.domain.com/$1 [P]
>
> When I am removing the [P] keyword and it tries to do a redirect it
> works fine.
>
> Would you advise me please something? Thanks.
>
> Please, drop me a Cc to my mail address, as far as I'm not regulary
> reading this newsgroups. Thanks.
>
> P.S. Apache 1.3.33 built from ports on FreeBSD 5.4-STABLE. I've got
> completely the same configuration on Apache 1.3.29 and it works just fine.


------------------------------------------------------------ ---------
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: Problems with proxying remote URLs

am 29.08.2005 14:07:54 von Axel-Stephane.SMORGRAV

In Apache 2.0 configurations you have no way of defining the order in =
which you wish the processing to take place. The order is more or less =
determined by the modules themselves, specifically by the way they =
register their hooks. A hook can be registered as FIRST, MIDDLE or LAST =
to roughly specify when it is supposed to be executed. The API also =
provides the possibility to specify modules that have to run before or =
after, if necessary.

An I tell you: as an Apache administrator it really is a relief not to =
have to worry about the order in which the modules are executed. That's =
one less thing that can go wrong, therefore one less thing to consider =
when shit hits the fan.

-ascs

-----Original Message-----
From: J=E9r=F4me Tytgat [mailto:jerome.tytgat@asterion.fr]=20
Sent: Monday, August 29, 2005 10:55 AM
To: users@httpd.apache.org
Subject: Re: [users@httpd] Re: Problems with proxying remote URLs


> If memory serves me right, the modules added last are the ones =
executed first.=20
> You want mod_proxy to be executed after mod_rewrite so mod_rewrite =
must be loaded after mod_proxy.

Interesting point, I was facing that kind of problem when I wanted to do =
rewrite rules plus proxypass.

What about Apache2 ?

How do you define the order when you use mods-enabled directory ?

By changing the name order ? (mod_proxy come first in directory listing)

Jerome.


------------------------------------------------------------ ---------
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: Problems with proxying remote URLs

am 29.08.2005 14:26:00 von jerome.tytgat

Ok.

How can you tell that mod_rewrite has to be executed BEFORE mod_proxy.

I would have used proxypass, but I can't because my rewrite are never reached and
I need some things to be rewritten BEFORE they are proxyfied.

Thanks.

J.

Axel-Stéphane SMORGRAV a écrit :
> In Apache 2.0 configurations you have no way of defining the order in which you wish the processing to take place. The order is more or less determined by the modules themselves, specifically by the way they register their hooks. A hook can be registered as FIRST, MIDDLE or LAST to roughly specify when it is supposed to be executed. The API also provides the possibility to specify modules that have to run before or after, if necessary.
>
> An I tell you: as an Apache administrator it really is a relief not to have to worry about the order in which the modules are executed. That's one less thing that can go wrong, therefore one less thing to consider when shit hits the fan.
>
> -ascs
>
>


------------------------------------------------------------ ---------
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: Problems with proxying remote URLs

am 29.08.2005 15:42:18 von Axel-Stephane.SMORGRAV

In Apache 1.3 I thought that was the case because what mod_rewrite =
actually does is prefixing to the rewritten URL with proxy: when the [P] =
flag is appended to the rewrite rule. I may be mistaken though, and 1.3 =
may use the same order as 2.0.

In Apache 2.0 mod_proxy is always run before mod_rewrite. That is why =
when you have a mix of ProxyPass and RewriteRule ... [P] that conflict, =
the RewriteRule is never executed. When that is the case, I use =
RewriteRules to do the proxying, and then add the ProxyPassReverse as =
needed. Then mod_rewrite forces the request through the proxy module by =
setting some fields in the request record object to apropriate values. =
SO although the proxy hooks are executed before the rewrite hooks, the =
rewrite module apparently has a way to invoke mod_proxy...


-ascs

-----Original Message-----
From: J=E9r=F4me Tytgat [mailto:jerome.tytgat@asterion.fr]=20
Sent: Monday, August 29, 2005 2:26 PM
To: users@httpd.apache.org
Subject: Re: [users@httpd] Re: Problems with proxying remote URLs

Ok.

How can you tell that mod_rewrite has to be executed BEFORE mod_proxy.

I would have used proxypass, but I can't because my rewrite are never =
reached and I need some things to be rewritten BEFORE they are =
proxyfied.

Thanks.

J.

------------------------------------------------------------ ---------
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: Problems with proxying remote URLs

am 29.08.2005 15:50:18 von jerome.tytgat

> In Apache 2.0 mod_proxy is always run before mod_rewrite. That is why when you have a mix of ProxyPass and RewriteRule ...
> [P] that conflict, the RewriteRule is never executed. When that is the case, I use RewriteRules to do the proxying, and
> then add the ProxyPassReverse as needed. Then mod_rewrite forces the request through the proxy module by setting some
> fields in the request record object to apropriate values. SO although the proxy hooks are executed before the rewrite
> hooks, the rewrite module apparently has a way to invoke mod_proxy...
>


That's what I've noted and what I'm doing.

But I was wondering about performance impact, maybe I'm wrong but rewrite rules are
quite heavy in processor use.

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