Re: how to suppress hard-coded response body in 302 redirect

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx




[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux