You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by David Salisbury <sa...@globe.gov> on 2006/10/05 20:40:59 UTC

[users@httpd] rewrite proxy and query string

Just wondering if this is possible.

Due to a technicality, I would like urls on our site asking for

/dir/prog?gl/clouds.men*
to be reverse proxied from
http://another.domain.com/dir/prog?gl/clouds.men*

So I'm trying.

RewriteEngine on
RewriteRule ^(/dir/prog?gl/clouds.men*) http://another.domain.com/$1 [p]

Doesn't seem to work though by itself.  For this to work though, the docs say for the P flag
"Note: mod_proxy must be enabled in order to use this flag."

Well, the module is loaded, but  I'm not sure what I need to kick Proxy off.  I tried these two 
settings.

ProxyPassReverse  /dir/prog?gl/clouds.men?gl/clouds.men  http://another.domain.com/dir/prog?gl/clouds.men
ProxyPassReverse  /dir/prog?gl/clouds.men?gl/clouds.men  http://another.domain.com/dir/prog?gl/clouds.men

ProxyPassReverse  /dir/prog?gl/clouds.men http://another.domain.com/dir/prog?gl/clouds.men 
ProxyPassReverse  /dir/prog?gl/clouds.men http://another.domain.com/dir/prog?gl/clouds.men 

using either one of the above gets me a " proxy: No protocol handler was valid for the URL" error.

But perhaps since an argument in the query string is needed to proxy the approprate page,
I am simply out of luck, as the ProxyPass directive needs....
"a partial URL for the remote server and cannot include a query string."
I do not what _all_ the /dir/prog requests proxied.

Is what I'm trying to do possible?  Any help is appreciated.  Thanks!

-ds





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


[users@httpd] Re: rewrite proxy and query string

Posted by Joost de Heer <sa...@xs4all.nl>.
> Doesn't seem to work though by itself.  For this to work though, the docs
> say for the P flag
> "Note: mod_proxy must be enabled in order to use this flag."

[snip]

> using either one of the above gets me a " proxy: No protocol handler was
> valid for the URL" error.

I assume you're using Apache 2.x.

Did you load mod_proxy_http? mod_proxy is just a general wrapper for proxy
support, with mod_proxy_[protocol] you add the protocol-specific knowledge
to Apache, in your case you need the http knowledge.

Joost


---------------------------------------------------------------------
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] rewrite proxy and query string

Posted by Joshua Slive <jo...@slive.ca>.
On 10/5/06, David Salisbury <sa...@globe.gov> wrote:
> Thanks for the tip, and I have looked into it.  Acutally, right now, in my deconstruction of this,
> I'm just trying to get mod_rewrite to rewrite _anything_!
>
> RewriteEngine on
> RewriteLogLevel 9
> RewriteRule  ^sda-bin(.*) ddl-bin$1
>
> ScriptAlias /sda-bin/  /some/dir/    # doesn't seem to mater either above or below.
>
> and a request to http://domain.com/sda-bin/m2h?gl/clouds.men returns as normal.
> No rewrite logging comes through either.  Maybe that doesn't get turned on unless
> there's a match, but it should be matching.  This module hold's it's secrets well. :(
>
> thanx for any clues... and I have cleared my cache, and the access_log log's the
> query as normal.  Startup is fine, so the module must be loaded.

In what part of httpd.conf are you placing this?  It is best to place
it ouside any <Directory> section, in which case you need absolute
web-paths.  The absence of a rewritelog would indicate that the
rewriterules are not coming anywhere near the request, since you
should get evidence even of missed matches.

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] rewrite proxy and query string

Posted by David Salisbury <sa...@globe.gov>.
Thanks for the tip, and I have looked into it.  Acutally, right now, in my deconstruction of this,
I'm just trying to get mod_rewrite to rewrite _anything_!

RewriteEngine on
RewriteLogLevel 9
RewriteRule  ^sda-bin(.*) ddl-bin$1

ScriptAlias /sda-bin/  /some/dir/    # doesn't seem to mater either above or below.

and a request to http://domain.com/sda-bin/m2h?gl/clouds.men returns as normal.
No rewrite logging comes through either.  Maybe that doesn't get turned on unless
there's a match, but it should be matching.  This module hold's it's secrets well. :(

thanx for any clues... and I have cleared my cache, and the access_log log's the 
query as normal.  Startup is fine, so the module must be loaded.

-ds



----- Original Message ----- 
From: "Joshua Slive" <jo...@slive.ca>
To: <us...@httpd.apache.org>
Sent: Thursday, October 05, 2006 1:00 PM
Subject: Re: [users@httpd] rewrite proxy and query string


> On 10/5/06, David Salisbury <sa...@globe.gov> wrote:
>>
>> Just wondering if this is possible.
>>
>> Due to a technicality, I would like urls on our site asking for
>>
>> /dir/prog?gl/clouds.men*
>> to be reverse proxied from
>> http://another.domain.com/dir/prog?gl/clouds.men*
>>
>> So I'm trying.
>>
>> RewriteEngine on
>> RewriteRule ^(/dir/prog?gl/clouds.men*) http://another.domain.com/$1 [p]
>>
>> Doesn't seem to work though by itself.
> 
> In the docs for RewriteRule, see the big box labeled "Query String".
> You need something like:
> 
> RewriteEngine On
> RewriteCond %{QUERY_STRING} ^gl/clouds.men
> RewriteRule ^/dir/prog http://another.domain.com/dir/prog [P]
> 
> 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
> 
>


---------------------------------------------------------------------
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] rewrite proxy and query string

Posted by Joshua Slive <jo...@slive.ca>.
On 10/5/06, David Salisbury <sa...@globe.gov> wrote:
>
> Just wondering if this is possible.
>
> Due to a technicality, I would like urls on our site asking for
>
> /dir/prog?gl/clouds.men*
> to be reverse proxied from
> http://another.domain.com/dir/prog?gl/clouds.men*
>
> So I'm trying.
>
> RewriteEngine on
> RewriteRule ^(/dir/prog?gl/clouds.men*) http://another.domain.com/$1 [p]
>
> Doesn't seem to work though by itself.

In the docs for RewriteRule, see the big box labeled "Query String".
You need something like:

RewriteEngine On
RewriteCond %{QUERY_STRING} ^gl/clouds.men
RewriteRule ^/dir/prog http://another.domain.com/dir/prog [P]

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