Thanks, Nick! mod_asis does not really help, as built-in filters mess with my response (remove content-length: 0 and add default content-type), but at least I now understand better what's going on. Useful site as well - keep working on it!
Peter On Mon, Aug 29, 2011 at 8:14 PM, Nick Kew <[email protected]> wrote: > On 29 Aug 2011, at 23:21, Peter Glasten wrote: > > > Hello! > > > > In my Apache module > > Since this is a development question, it would be more on-topic > for the modules-dev list than here. > > > (module AP_MODULE_DECLARE_DATA ... etc etc - low-level Apache module > written in C) I need to return a 302 redirect status with no body, > Content-Length set to zero, and no content-type (this is a third-party > requirement that I cannot change). Apache by default adds hard-coded HTML > body and text/html content type. > > That depends on how/where your module triggers the 302 response. > If it does so by returning 302 from a pre-handler hook (like, for example, > mod_alias and mod_rewrite do) then you get what you describe. > If it works as a handler like CGI or PHP, then you (can easily) > get what you want and expect. Take a look at mod_asis for a > startingpoint to do it that way. > > Alternatively (and unless your module is doing something v.strange) > you should be able to delegate the 302 response to the server admin. > Your module just sets a Location and returns 302, but you can use the > ErrorDocument directive to customise your response. With a .asis > ErrorDocument you have full control over the headers. > > Note that Content-Length: 0 is redundant, in the absence of anything > that would lead a client to expect contents. > > See also the book: http://www.apachetutor.org/ > > -- > Nick Kew >
