views:

21

answers:

1

The title of this question may be a bit misleading. I couldn't quite think of anything better.

Here is my problem. I am developing an Apache module that needs to manipulate a bit of content in the requested HTML document (this document can be a file on the disk or may be dynamically generated by CGI or PHP) and so I am using libxml2 with it.

I developed something working, but the problem is that when the browser requests for a page, let's say

http://localhost/a.html

the module does it's job. But if that page has references to a javascript file, a.js, or a stylesheet file, a.css, they are not getting served.

The reason as I perceived by examining the logs is that, as the browser sends requests for a javascript file let's say

[http://localhost/a.js] //putting [] because of limit of 1 url per post.

Apache again runs my module, the module uses a HTML parser, so when the content is not HTML, it gives error and exits, the request is abandoned.

How can I make my module to work only for text/html requests ?

A: 

I don't know how to make your module to decline the request. But if you don't figure how to do it you can just configure it in httpd.conf

AddHandler my-handler .html
Kakao
yes that's how I am doing it currently. What other extensions should I put in the directive to make my module more fail-proof. some of the other popular extension I know are .shtml, .php,etc.
Abhinav Upadhyay