I have an apache module which uses the ap_hook_post_read_request
hook to perform an internal redirect when certain conditions are met. I would like to restrict this handler to a single virtual host but currently it fires on all virtual hosts (there are many). The httpd.conf configuration is limited to the LoadModule
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.
Asked
Active
Viewed 786 times
0

Andrew
- 716
- 1
- 8
- 19
2 Answers
1
I created some custom config in the vhost. I look for this config in the module and return if it doesn't have the config, so this in effect allows me to restrict the module to a vhost.

Andrew
- 716
- 1
- 8
- 19
0
Try this:
# VirtualHost1 = localhost:80
<IfModule mod_weblogic.c>
<VirtualHost 127.0.0.1:80>
DocumentRoot "C:/test/VirtualHost1"
ServerName localhost:80
</VirtualHost>
</IfModule>

Pang
- 9,564
- 146
- 81
- 122

Yogendra Sharma
- 21
- 3
-
The issue is not that the handler isn't being invoked for a specific vhost, but that it is being invoked on all vhosts and I only want it to apply to a single vhost – Andrew Jul 06 '12 at 16:01