You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "Mike F. @ LabJack" <mi...@labjack.com> on 2011/06/24 23:10:40 UTC
[users@httpd] mod_rewrite: External RewriteMap program never gets input
I am attempting to use an external program in RewriteMap. It seems that no
matter what I do, data never makes it to my program.
I'm on an Ubuntu 11.04 machine, running Apache 2.2.17.
My /etc/apache2/sites-available/mynewsite looks like this:
RewriteEngine On
RewriteLock "/var/run/rewrite-lock.lock"
RewriteMap rmsp "prg:/usr/local/bin/rmsp.py"
My .htaccess file looks like this:
RewriteEngine On
RewriteBase /
RewriteRule foo/([^/]*) /bar/${rmsp:$1}/feed [R=301,L]
rmsp.py:
#!/usr/bin/python -u
import sys
import logging
logging.basicConfig(filename='/home/user/vhost/log/rmsp.log',level=logging.DEBUG)
logging.debug('rmsp started.')
while True:
logging.debug('Waiting for input...')
data = sys.stdin.readline()
logging.debug('Data recieved: %s' % data )
if data:
logging.debug('printing: %s' % data )
print data,
sys.stdout.flush()
else:
logging.debug('eof. Breaking...')
break
When I look at the log, I see:
DEBUG:root:rmsp started.
DEBUG:root:Waiting for input...
So, for some reason, my program is never getting any data. When I turn on
Rewrite logging, I don't see the "map lookup OK: map=rmsp key=stuff ->
val=stuff". It just does this:
10.1.10.14 - - [24/Jun/2011:13:11:17 --0600]
[mytestmachine.mikerocks.com/sid#7f9c98c36760][rid#7f9c98ed6fb0/initial] (3)
[perdir /home/user/vhost/] applying pattern 'foo/([^/]*)' to uri
'foo/ilovekittens'
10.1.10.14 - - [24/Jun/2011:13:11:17 --0600]
[mytestmachine.mikerocks.com/sid#7f9c98c36760][rid#7f9c98ed6fb0/initial] (2)
[perdir /home/user/vhost/] rewrite 'tag/ilovekittens' -> '/bar//feed'
10.1.10.14 - - [24/Jun/2011:13:11:17 --0600]
[mytestmachine.mikerocks.com/sid#7f9c98c36760][rid#7f9c98ed6fb0/initial] (2)
[perdir /home/user/vhost/] explicitly forcing redirect with
http://mytestmachine.mikerocks.com/tag//feed
I've tried using the internal function "int" mapping, and that works.
Any ideas on what I'm doing wrong? Is there other information that is
important/helpful?
--
View this message in context: http://old.nabble.com/mod_rewrite%3A-External-RewriteMap-program-never-gets-input-tp31923146p31923146.html
Sent from the Apache HTTP Server - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
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] mod_rewrite: External RewriteMap program never
gets input
Posted by "Mike F. @ LabJack" <mi...@labjack.com>.
Eric Covener wrote:
>
> I know the manual says using a map in per-dir context works [in
> general] when you defined it at proper scope, but can you try using
> your self-defined map in the context you defined it? Maybe it just
> doesn't work for non-internal maps?
>
I had tried putting this in my virtual host config, and the rule never got
checked:
RewriteRule (.*) /bar/${rmsp:$1}/feed [R=301,L]
Is that what you are suggesting?
--
View this message in context: http://old.nabble.com/mod_rewrite%3A-External-RewriteMap-program-never-gets-input-tp31923146p31923529.html
Sent from the Apache HTTP Server - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
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] mod_rewrite: External RewriteMap program never gets input
Posted by Eric Covener <co...@gmail.com>.
On Fri, Jun 24, 2011 at 5:25 PM, Mike F. @ LabJack <mi...@labjack.com> wrote:
>
>
> Eric Covener wrote:
>>
>> Are you 100% sure your request is handled by this virtual host?
>>
>
> Yes. No other virtual hosts point to that directory. When I had other rules
> in the .htaccess file, they worked as expected.
>
> I've also tried RewriteMap lower int:tolower, and that worked.
I know the manual says using a map in per-dir context works [in
general] when you defined it at proper scope, but can you try using
your self-defined map in the context you defined it? Maybe it just
doesn't work for non-internal maps?
> --
> View this message in context: http://old.nabble.com/mod_rewrite%3A-External-RewriteMap-program-never-gets-input-tp31923146p31923214.html
> Sent from the Apache HTTP Server - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> 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
>
>
--
Eric Covener
covener@gmail.com
---------------------------------------------------------------------
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] mod_rewrite: External RewriteMap program never
gets input
Posted by "Mike F. @ LabJack" <mi...@labjack.com>.
Eric Covener wrote:
>
> Are you 100% sure your request is handled by this virtual host?
>
Yes. No other virtual hosts point to that directory. When I had other rules
in the .htaccess file, they worked as expected.
I've also tried RewriteMap lower int:tolower, and that worked.
--
View this message in context: http://old.nabble.com/mod_rewrite%3A-External-RewriteMap-program-never-gets-input-tp31923146p31923214.html
Sent from the Apache HTTP Server - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
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] mod_rewrite: External RewriteMap program never gets input
Posted by Eric Covener <co...@gmail.com>.
> My /etc/apache2/sites-available/mynewsite looks like this:
Are you 100% sure your request is handled by this virtual host?
---------------------------------------------------------------------
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