Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Apache: Users

prg with rewrite_map does not seem to be working, maybe a bug

 

 

Apache users RSS feed   Index | Next | Previous | View Threaded


alijawad1 at gmail

Jun 30, 2009, 8:03 AM

Post #1 of 9 (642 views)
Permalink
prg with rewrite_map does not seem to be working, maybe a bug

Hi All
I have been on these for 4 days now. No matter what I feed my simple perl
script in a simple rewrite_map setup it wont return any feedback when used
through apache. When used through comand line it works just fine.

Some background info:

debian:/var/www# apache2 -v
Server version: Apache/2.2.9 (Debian)
Server built: Jun 1 2009 17:44:04


####.htaccess
RewriteEngine on
RewriteCond ${dash2score:yes} yes
RewriteRule ^(.*)$ http://www.howstuffworks.com [P,L]d

or

RewriteEngine on
RewriteRule ^(.*)$ http://www.google.com/?index=${dash2score:yes} [P,L]

#####Apache2.conf
RewriteLog "/var/log/apache2/rewrite.log"
RewriteLogLevel 9
RewriteMap dash2score prg:/var/www/getIpStat.pl

##### getIpStat.pl

#!/usr/bin/perl
$| = 1;
while (<STDIN>) {
print($_."\n");
}

or
#!/usr/bin/perl
$| = 1;
while (<STDIN>) {
print($_."\n");
}


Well, the perl script simply returns whatever it is fed, so If I feed it yes
it returns yes, this would not work when I used the rewritemap with
rewritecond I would alwasy get no output. Since rewritecond would return
input='' as if rewritecond is not returning any input. The log showed:

192.168.0.189 - - [30/Jun/2009:18:00:08 +0300] [
192.168.0.1/sid#9500ba8][rid#b5f40078/subreq] (5) map lookup FAILED:
map=dash2score key=yes
192.168.0.189 - - [30/Jun/2009:18:00:08 +0300] [
192.168.0.1/sid#9500ba8][rid#b5f40078/subreq] (4) [perdir /var/www/]
RewriteCond: input='' pattern='yes' => not-matched
192.168.0.189 - - [30/Jun/2009:18:00:08 +0300] [
192.168.0.1/sid#9500ba8][rid#b5f40078/subreq] (1) [perdir /var/www/] pass
through /var/www/index.pl

Note the input='' above I.e. rewritecond did not show get any input from the
rewrite map

When I did try to use the rewritemap in the rewriterule as in the second
example it did not display anything as well in the result URL. The log
showed:

192.168.0.189 - - [30/Jun/2009:17:58:17 +0300] [
192.168.0.1/sid#9500ba8][rid#b61c4610/initial] (5) map lookup FAILED:
map=dash2score key=yes
192.168.0.189 - - [30/Jun/2009:17:58:17 +0300] [
192.168.0.1/sid#9500ba8][rid#b61c4610/initial] (2) [perdir /var/www/]
rewrite '' -> 'http://www.google.com/?index='


Note the index=' above


If I run the script from command line the following is shown:

debian:/var/www# ./getIpStat.pl
input1
input1

I enter input1 and it echoes input1

These are the permissions of the script:

-rwxr-xr-x 1 www-data root 352 2009-06-30 16:40 getIpStat.pl


and I did su to www-data and I was able to execute it successfully.


I really have no clue why the script is not returning any output when
invoked through apache.

Any clues ?

Thanks


aw at ice-sa

Jun 30, 2009, 8:19 AM

Post #2 of 9 (598 views)
Permalink
Re: prg with rewrite_map does not seem to be working, maybe a bug [In reply to]

Ali Jawad wrote:
...
Try :
>
> #!/usr/bin/perl
> $| = 1;
> while (<STDIN>) {
chomp $_;
> print($_."\n");
> }
>

---------------------------------------------------------------------
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
" from the digest: users-digest-unsubscribe [at] httpd
For additional commands, e-mail: users-help [at] httpd


bobsiegen at googlemail

Jun 30, 2009, 8:29 AM

Post #3 of 9 (599 views)
Permalink
Re: prg with rewrite_map does not seem to be working, maybe a bug [In reply to]

2009/6/30 Ali Jawad <alijawad1 [at] gmail>:
> #####Apache2.conf
> RewriteLog "/var/log/apache2/rewrite.log"
> RewriteLogLevel 9
> RewriteMap dash2score prg:/var/www/getIpStat.pl

There's no RewriteEngine directive set to "on" in your Apache2.conf?
In such a case the map program shouldn't be started during server
startup.

Bob

---------------------------------------------------------------------
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
" from the digest: users-digest-unsubscribe [at] httpd
For additional commands, e-mail: users-help [at] httpd


alijawad1 at gmail

Jun 30, 2009, 11:29 AM

Post #4 of 9 (598 views)
Permalink
Re: prg with rewrite_map does not seem to be working, maybe a bug [In reply to]

Hi Bob
Thanks for the hint, isn't it enough to set it to on in .htacccess.
Thanks

On Tue, Jun 30, 2009 at 6:29 PM, Bob Ionescu <bobsiegen [at] googlemail>wrote:

> 2009/6/30 Ali Jawad <alijawad1 [at] gmail>:
> > #####Apache2.conf
> > RewriteLog "/var/log/apache2/rewrite.log"
> > RewriteLogLevel 9
> > RewriteMap dash2score prg:/var/www/getIpStat.pl
>
> There's no RewriteEngine directive set to "on" in your Apache2.conf?
> In such a case the map program shouldn't be started during server
> startup.
>
> Bob
>
> ---------------------------------------------------------------------
> 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
> " from the digest: users-digest-unsubscribe [at] httpd
> For additional commands, e-mail: users-help [at] httpd
>
>


alijawad1 at gmail

Jun 30, 2009, 11:30 AM

Post #5 of 9 (597 views)
Permalink
Re: prg with rewrite_map does not seem to be working, maybe a bug [In reply to]

Hi
Thanks Andre for the hint, I will try it and report back.
Regards

On Tue, Jun 30, 2009 at 6:19 PM, André Warnier <aw [at] ice-sa> wrote:

> Ali Jawad wrote:
> ...
> Try :
>
>>
>> #!/usr/bin/perl
>> $| = 1;
>> while (<STDIN>) {
>>
> chomp $_;
>
>> print($_."\n");
>> }
>>
>>
> ---------------------------------------------------------------------
> 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
> " from the digest: users-digest-unsubscribe [at] httpd
> For additional commands, e-mail: users-help [at] httpd
>
>


bobsiegen at googlemail

Jun 30, 2009, 12:16 PM

Post #6 of 9 (597 views)
Permalink
Re: prg with rewrite_map does not seem to be working, maybe a bug [In reply to]

2009/6/30 Ali Jawad <alijawad1 [at] gmail>:
> isn't it enough to set it to on in .htacccess.

Not for the map type prg. But why don't you use the rules in your
apache2.conf? Since you're rewriting to a reverse proxy situation, you
could avoid the <directory> and <files> walk.

Bob

---------------------------------------------------------------------
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
" from the digest: users-digest-unsubscribe [at] httpd
For additional commands, e-mail: users-help [at] httpd


alijawad1 at gmail

Jun 30, 2009, 12:18 PM

Post #7 of 9 (595 views)
Permalink
Re: prg with rewrite_map does not seem to be working, maybe a bug [In reply to]

I tried in apache.conf however at that point the rewrite log was not showing
anything at all as if it was not being invoked....i dont have any
vhosts..just a regular installation.

On Tue, Jun 30, 2009 at 10:16 PM, Bob Ionescu <bobsiegen [at] googlemail>wrote:

> 2009/6/30 Ali Jawad <alijawad1 [at] gmail>:
> > isn't it enough to set it to on in .htacccess.
>
> Not for the map type prg. But why don't you use the rules in your
> apache2.conf? Since you're rewriting to a reverse proxy situation, you
> could avoid the <directory> and <files> walk.
>
> Bob
>
> ---------------------------------------------------------------------
> 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
> " from the digest: users-digest-unsubscribe [at] httpd
> For additional commands, e-mail: users-help [at] httpd
>
>


alijawad1 at gmail

Jul 1, 2009, 7:04 AM

Post #8 of 9 (578 views)
Permalink
Re: prg with rewrite_map does not seem to be working, maybe a bug [In reply to]

Well I did apply the changes mentioned and prg started returning results.
However [P,L] now does not work the server throws


Request Error (invalid_request)

Your request could not be processed. Request could not be handled This
could be caused by a misconfiguration, or possibly a malformed request.
For assistance, contact your network support team.



At me, I did undo my changes but I am still getting that error..will
investigate logs.

Regards

On Tue, Jun 30, 2009 at 12:18 PM, Ali Jawad <alijawad1 [at] gmail> wrote:

> I tried in apache.conf however at that point the rewrite log was not
> showing anything at all as if it was not being invoked....i dont have any
> vhosts..just a regular installation.
>
>
> On Tue, Jun 30, 2009 at 10:16 PM, Bob Ionescu <bobsiegen [at] googlemail>wrote:
>
>> 2009/6/30 Ali Jawad <alijawad1 [at] gmail>:
>> > isn't it enough to set it to on in .htacccess.
>>
>> Not for the map type prg. But why don't you use the rules in your
>> apache2.conf? Since you're rewriting to a reverse proxy situation, you
>> could avoid the <directory> and <files> walk.
>>
>> Bob
>>
>> ---------------------------------------------------------------------
>> 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
>> " from the digest: users-digest-unsubscribe [at] httpd
>> For additional commands, e-mail: users-help [at] httpd
>>
>>
>


covener at gmail

Jul 1, 2009, 7:22 AM

Post #9 of 9 (586 views)
Permalink
Re: prg with rewrite_map does not seem to be working, maybe a bug [In reply to]

On Wed, Jul 1, 2009 at 10:04 AM, Ali Jawad<alijawad1 [at] gmail> wrote:
> Well I did apply the changes mentioned and prg started returning results.
> However [P,L] now does not work the server throws
>
>
> Request Error (invalid_request)

Proxy loaded? Did your rewrite Proxy to a well-formed URL?

RewriteLog might hekp here.

--
Eric Covener
covener [at] gmail

---------------------------------------------------------------------
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
" from the digest: users-digest-unsubscribe [at] httpd
For additional commands, e-mail: users-help [at] httpd

Apache users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.