I've got a CGI script that prints the next on stdout:

print "Status: 302 Redirect\n";
print "Server: Apache-Coyote/1.1\n";
print "Location: $redirect\n";
print "Content-Length: 0\n";
print "Date: $date\n\n";

Where $redirect and $date are reasonable values. What Apache2 really transmits includes a Content-Type: header (text/plain). I have said the DefaultType within the server configuration file.

I am attempting to debug a downstream problem that arises when no Content-Type: header is distributed. What exactly miracle incantation must i perform to prevent Apache2 from adding this content type header?

Based on my (of course brief) reading through of server/protocol.c and server/core.c, you can't.

It always defaults to DefaultType (text/plain automatically) in the event that header isn't present.

You can test using the directive:

ResponseHeader unset Content-Type

When I read the Apache paperwork under consideration, what you would like may really be

Header unset Content-Type

Hope this may it!

RemoveType stop delivering a content type using the resource.


<Files defaulttypenone.txt>
DefaultType None 
<Files removetype.txt>
RemoveType .txt
<Files forcetype.txt>
ForceType None

Examined by myself server, these three solutions and none labored. All of them came back text/plain.

If all you are attempting to complete is prep a really specific test situation server-side, you could "cheat" by pre-baking output inside a text file and getting netcat listen for connections on some port.

I personally use that trick when I wish to be 100% certain of each byte the server transmits.