httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jamis Buck <>
Subject request for feedback on mod_reproxy implementation
Date Fri, 06 Nov 2009 18:30:23 GMT
I'm new to apache module development. I've picked up "The Apache
Modules Book" by Nick Kew, and read through it, and I've read through
various modules (including mod_proxy). My goal was to write a
mod_reproxy module (to implement the X-Reproxy-Url functionality from
Danga Interactive's perlbal load balancer).

The good news is: my implementation appears to actually work! But
since this is my first module, I would really appreciate any feedback
that more experienced apache module developers can provide. The
project is here:

The mod_reproxy.c file, specifically, is here:

And the README (with more information about how the module works) is here:

My first question about the implementation is how I'm (ab)using the
functions provided by mod_proxy. If you look at the
reproxy_initialize_worker function (starting at line 154):

I'm basically just mimicking mod_proxy's internal code for adding a
new worker. However, whereas mod_proxy caches those created workers in
a pool, mod_reproxy doesn't (because each response may return an
entirely new location to reproxy, so it doesn't necessarily make sense
to cache the workers). I'm not entirely sure if my create-and-discard
approach to proxy workers is a well-supported scenario in mod_proxy,
and I worry that I may be introducing some subtle memory leak by doing
so. I couldn't see anything that would indicate such a leak from my
walk-thru of mod_proxy, but there's a lot of code there!

My second question deals with the implementation of my output filter,
reproxy_output_filter, starting on line 281:

Because the reproxied response needs to replace the output from the
original response, I would like to wholly discard the original
response body. I'm not sure how to do that. :) For now, I'm relying on
the backend to return an empty response, but that's a fragile

My third question is a more general one. I'm relying on the reproxied
response to somehow (magically?) insert itself into the original
response's. It works, but I don't know how or why it works. I've tried
tracing the code through and got lost. I worry that I'm the happy
beneficiary of an unintended side-effect, and I'd like to be on more
solid footing here. :)

Other observations unrelated to my two questions will be appreciated
as well, if you happen to see that I'm doing something stupid and/or


- Jamis Buck

View raw message