You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Andrew <su...@gmail.com> on 2012/07/06 21:44:54 UTC

[users@httpd] Restricting an Apache Module (Handler) to a Virtual Host

I have written an Apache Module that performs an internal redirect
(ap_internal_redirect) based on certain conditions. Then mod_proxy
handles proxying the request to a backend server. I'm using the
ap_hook_post_read_request hook with APR_HOOK_MIDDLE. I would like to
restrict this handler to a single virtual host but currently it is
invoked on all virtual host requests (there are many). The httpd.conf
configuration is limited to theLoadModule directive. I've tried using
SetHandler handlername in the vhost and SetHandler None in the main
config but the handler is still invoked on requests to other vhosts.
The module also registers the ap_register_output_filter hook but the
output filter does not perform any action other than removing itself
and passing control onwards. I've been reading through The Apache
Modules Book, which has been very helpful but I can't seem to find
much information on how to solve this particular issue.

Thanks,

Andrew

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Restricting an Apache Module (Handler) to a Virtual Host

Posted by Eric Covener <co...@gmail.com>.
On Sat, Jul 7, 2012 at 9:12 AM, Daniel Ruggeri <DR...@primary.net> wrote:
> On 7/6/2012 2:44 PM, Andrew wrote:
>> I have written an Apache Module that performs an internal redirect
>> (ap_internal_redirect) based on certain conditions. Then mod_proxy
>> handles proxying the request to a backend server. I'm using the
>> ap_hook_post_read_request hook with APR_HOOK_MIDDLE. I would like to
>> restrict this handler to a single virtual host but currently it is
>> invoked on all virtual host requests (there are many). The httpd.conf
>> configuration is limited to theLoadModule directive. I've tried using
>> SetHandler handlername in the vhost and SetHandler None in the main
>> config but the handler is still invoked on requests to other vhosts.

If you care about the handler, you have to check it yourself in your
module and return DECLINED if it's not tagged for you.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Restricting an Apache Module (Handler) to a Virtual Host

Posted by Daniel Ruggeri <DR...@primary.net>.
On 7/6/2012 2:44 PM, Andrew wrote:
> I have written an Apache Module that performs an internal redirect
> (ap_internal_redirect) based on certain conditions. Then mod_proxy
> handles proxying the request to a backend server. I'm using the
> ap_hook_post_read_request hook with APR_HOOK_MIDDLE. I would like to
> restrict this handler to a single virtual host but currently it is
> invoked on all virtual host requests (there are many). The httpd.conf
> configuration is limited to theLoadModule directive. I've tried using
> SetHandler handlername in the vhost and SetHandler None in the main
> config but the handler is still invoked on requests to other vhosts.
> The module also registers the ap_register_output_filter hook but the
> output filter does not perform any action other than removing itself
> and passing control onwards. I've been reading through The Apache
> Modules Book, which has been very helpful but I can't seem to find
> much information on how to solve this particular issue.
>
> Thanks,
>
> Andrew

Andrew;
   I don't have an answer for your question top-of-mind, but you may
have better luck asking this question on the modules-dev mailing list:
http://httpd.apache.org/lists.html#modules-dev

-- 
Daniel Ruggeri


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org