You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Vladimir Vanuukov <vl...@gmail.com> on 2008/02/29 21:48:19 UTC

[users@httpd] Using ExtFilterDefine to filter the output of a CGI command (Apache 2.2)

Hi, I can't seem to figure out how to get a filter defined by 
ExtFilterDefine to filter the output of a cgi program (in this case 
CGIProxy). I've been hitting my head against a brick wall for a day now 
and i still can't get this to work.

I define the filter using
/ExtFilterDefine vlads mode=output cmd="/bin/sed 
s/some_text/some_other_text/g"/

Which appears at the very top of a site config file. Then inside of a 
<VirtualHost *> i have
/SetOutputFilter vlads/

I then define the cgi-bin using
/   Alias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory /usr/lib/cgi-bin>
       SetOutputFilter vlads
        AllowOverride None
        SetHandler cgi-script
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch +Indexes
        Order allow,deny
        Allow from all
    </Directory>
/
When i go to any other page on this site the filter works, however the 
output of the cgi scripts (CGProxy) goes through unfiltered. Any help 
would be great
There is nothing in the error log and nothign special in the access log 
either.
Thanks

Re: [users@httpd] Using ExtFilterDefine to filter the output of a CGI command (Apache 2.2)

Posted by Nick Kew <ni...@webthing.com>.
On 7 Mar 2008, at 05:39, Vladimir Vanuukov wrote:
>>>
>>>  I define the filter using
>>>  ExtFilterDefine vlads mode=output cmd="/bin/sed
>>> s/some_text/some_other_text/g"

Why use ext_filter (with its very substantial performance penalty)
when you could accomplish the same using mod_line_edit or
mod_substitute?

-- 
Nick Kew

---------------------------------------------------------------------
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] Using ExtFilterDefine to filter the output of a CGI command (Apache 2.2)

Posted by Vladimir Vanuukov <vl...@gmail.com>.
I have tried both of those things and its doesn't help, there are no 
messages in the Log files and even when i use

<Location /cgi-bin>
    SetOutputFilter vlads
</Location>

it still does not filter, does anyone have any ideas?

Joshua Slive wrote:
> On Fri, Feb 29, 2008 at 3:48 PM, Vladimir Vanuukov <vl...@gmail.com> wrote:
>   
>>  Hi, I can't seem to figure out how to get a filter defined by
>> ExtFilterDefine to filter the output of a cgi program (in this case
>> CGIProxy). I've been hitting my head against a brick wall for a day now and
>> i still can't get this to work.
>>
>>  I define the filter using
>>  ExtFilterDefine vlads mode=output cmd="/bin/sed
>> s/some_text/some_other_text/g"
>>
>>  Which appears at the very top of a site config file. Then inside of a
>> <VirtualHost *> i have
>>  SetOutputFilter vlads
>>
>>  I then define the cgi-bin using
>>     Alias /cgi-bin/ /usr/lib/cgi-bin/
>>      <Directory /usr/lib/cgi-bin>
>>         SetOutputFilter vlads
>>          AllowOverride None
>>          SetHandler cgi-script
>>          Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch +Indexes
>>          Order allow,deny
>>          Allow from all
>>      </Directory>
>>
>>  When i go to any other page on this site the filter works, however the
>> output of the cgi scripts (CGProxy) goes through unfiltered. Any help would
>> be great
>>  There is nothing in the error log and nothign special in the access log
>> either.
>>     
>
> I don't see any particular problem with your setup.
>
> Have you tried turning up the logging using ExtFilterOptions?
> Have you tried activating using a <Location > instead of <Directory>?
>
> 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] Using ExtFilterDefine to filter the output of a CGI command (Apache 2.2)

Posted by Joshua Slive <jo...@slive.ca>.
On Fri, Mar 7, 2008 at 9:53 AM, Vladimir Vanuukov <vl...@gmail.com> wrote:
> The script is CGIProxy, is there a good non nph alternative?

You're really adding hack on top of hack there! I hope you're just
doing this for fun, since what you're creating is a Frankenstein's
nightmare.

Anyway, I would either 1) run a real proxy, rather than CGIProxy, 2)
do whatever text mangling you need inside the CGIProxy script instead
of with mod_ext_filter, or 3) Set $NOT_RUNNING_AS_NPH in CGIProxy and
rename it to not start with nph-.

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] Using ExtFilterDefine to filter the output of a CGI command (Apache 2.2)

Posted by Nick Kew <ni...@webthing.com>.
On 7 Mar 2008, at 17:22, Vladimir wrote:

> Cgiproxy is a web-based proxy. I can go to the cgi script, type in  
> an address and [...]

OK, I see.  That's not what mod_proxy does, and I don't see a simple  
solution
based only on standard components (a complex solution with mod_rewrite,
mod_headers and mod_proxy_html might do the job, but I'm not about to
think that one through).

Anyway, since Joshua has now posted a sensible suggestion for you,
I'll bow out of this thread.

-- 
Nick Kew

---------------------------------------------------------------------
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] Using ExtFilterDefine to filter the output of a CGI command (Apache 2.2)

Posted by Vladimir <vl...@gmail.com>.
Cgiproxy is a web-based proxy. I can go to the cgi script, type in an address and it display the page fore me and allow to browse it. It will rewrite all the links to point to the server where cgiproxy resides. Don't sure how to do this with mod_proxy. Also for users who for wjatever reason can't set a proxy server (maybe they already go throught a proxy to get out to the net) this still works.
Sent via BlackBerry by AT&T

-----Original Message-----
From: Nick Kew <ni...@webthing.com>

Date: Fri, 7 Mar 2008 17:15:53 
To:users@httpd.apache.org
Subject: Re: [users@httpd] Using ExtFilterDefine to filter the output of a CGI command (Apache 2.2)


On 7 Mar 2008, at 14:53, Vladimir Vanuukov wrote:

> The script is CGIProxy, is there a good non nph alternative?
>
If you tell us what CGIProxy does for you that mod_proxy doesn't,
then maybe we could suggest something.

-- 
Nick Kew

---------------------------------------------------------------------
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] Using ExtFilterDefine to filter the output of a CGI command (Apache 2.2)

Posted by Nick Kew <ni...@webthing.com>.
On 7 Mar 2008, at 14:53, Vladimir Vanuukov wrote:

> The script is CGIProxy, is there a good non nph alternative?
>
If you tell us what CGIProxy does for you that mod_proxy doesn't,
then maybe we could suggest something.

-- 
Nick Kew

---------------------------------------------------------------------
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] Using ExtFilterDefine to filter the output of a CGI command (Apache 2.2)

Posted by Vladimir Vanuukov <vl...@gmail.com>.
The script is CGIProxy, is there a good non nph alternative?

Joshua Slive wrote:
> On Fri, Mar 7, 2008 at 12:49 AM, Vladimir Vanuukov <vl...@gmail.com> wrote:
>   
>> Just realized that the cgi script that is not getting filtered is a nph
>>  (non-parsed-headers) script. Other scrips in the same directory get
>>  filtered just fine. Any idea how to enable filtering for nph scripts?
>>     
>
> That may indeed be the problem. Why are you using an nph script
> anyway? The support for these scripts isn't very good in modern apache
> because they are basically a legacy item. There is no need for them on
> a modern web server.
>
> 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] Using ExtFilterDefine to filter the output of a CGI command (Apache 2.2)

Posted by Joshua Slive <jo...@slive.ca>.
On Fri, Mar 7, 2008 at 12:49 AM, Vladimir Vanuukov <vl...@gmail.com> wrote:
> Just realized that the cgi script that is not getting filtered is a nph
>  (non-parsed-headers) script. Other scrips in the same directory get
>  filtered just fine. Any idea how to enable filtering for nph scripts?

That may indeed be the problem. Why are you using an nph script
anyway? The support for these scripts isn't very good in modern apache
because they are basically a legacy item. There is no need for them on
a modern web server.

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] Using ExtFilterDefine to filter the output of a CGI command (Apache 2.2)

Posted by Vladimir Vanuukov <vl...@gmail.com>.
Just realized that the cgi script that is not getting filtered is a nph 
(non-parsed-headers) script. Other scrips in the same directory get 
filtered just fine. Any idea how to enable filtering for nph scripts?


Joshua Slive wrote:
> On Fri, Feb 29, 2008 at 3:48 PM, Vladimir Vanuukov <vl...@gmail.com> wrote:
>   
>>  Hi, I can't seem to figure out how to get a filter defined by
>> ExtFilterDefine to filter the output of a cgi program (in this case
>> CGIProxy). I've been hitting my head against a brick wall for a day now and
>> i still can't get this to work.
>>
>>  I define the filter using
>>  ExtFilterDefine vlads mode=output cmd="/bin/sed
>> s/some_text/some_other_text/g"
>>
>>  Which appears at the very top of a site config file. Then inside of a
>> <VirtualHost *> i have
>>  SetOutputFilter vlads
>>
>>  I then define the cgi-bin using
>>     Alias /cgi-bin/ /usr/lib/cgi-bin/
>>      <Directory /usr/lib/cgi-bin>
>>         SetOutputFilter vlads
>>          AllowOverride None
>>          SetHandler cgi-script
>>          Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch +Indexes
>>          Order allow,deny
>>          Allow from all
>>      </Directory>
>>
>>  When i go to any other page on this site the filter works, however the
>> output of the cgi scripts (CGProxy) goes through unfiltered. Any help would
>> be great
>>  There is nothing in the error log and nothign special in the access log
>> either.
>>     
>
> I don't see any particular problem with your setup.
>
> Have you tried turning up the logging using ExtFilterOptions?
> Have you tried activating using a <Location > instead of <Directory>?
>
> 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] Using ExtFilterDefine to filter the output of a CGI command (Apache 2.2)

Posted by Joshua Slive <jo...@slive.ca>.
On Fri, Feb 29, 2008 at 3:48 PM, Vladimir Vanuukov <vl...@gmail.com> wrote:
>
>
>  Hi, I can't seem to figure out how to get a filter defined by
> ExtFilterDefine to filter the output of a cgi program (in this case
> CGIProxy). I've been hitting my head against a brick wall for a day now and
> i still can't get this to work.
>
>  I define the filter using
>  ExtFilterDefine vlads mode=output cmd="/bin/sed
> s/some_text/some_other_text/g"
>
>  Which appears at the very top of a site config file. Then inside of a
> <VirtualHost *> i have
>  SetOutputFilter vlads
>
>  I then define the cgi-bin using
>     Alias /cgi-bin/ /usr/lib/cgi-bin/
>      <Directory /usr/lib/cgi-bin>
>         SetOutputFilter vlads
>          AllowOverride None
>          SetHandler cgi-script
>          Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch +Indexes
>          Order allow,deny
>          Allow from all
>      </Directory>
>
>  When i go to any other page on this site the filter works, however the
> output of the cgi scripts (CGProxy) goes through unfiltered. Any help would
> be great
>  There is nothing in the error log and nothign special in the access log
> either.

I don't see any particular problem with your setup.

Have you tried turning up the logging using ExtFilterOptions?
Have you tried activating using a <Location > instead of <Directory>?

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