default_type should default to nothing (RFC 2616)

sbwoodside nginx-forum at nginx.us
Thu Apr 30 06:41:37 MSD 2009


I am new to nginx but I just noticed that, at least on ubuntu,

default_type  application/octet-stream;

is the default setting, and the wiki says that if I remove it, the default will go to text/plain. This is not good!

For an extremely detailed discussion of this issue, please see the resolved/fixed bug for apache:
  https://issues.apache.org/bugzilla/show_bug.cgi?id=13986

The crux of the conclusion is from this passage in RFC 2616 ( http://www.w3.org/Protocols/rfc2616/rfc2616-sec7.html#sec7.2.1 ):

 Any HTTP/1.1 message containing an entity-body SHOULD include a Content-Type header field defining the media type of that body. If and only if the media type is not given by a Content-Type field, the recipient MAY attempt to guess the media type via inspection of its content and/or the name extension(s) of the URI used to identify the resource. If the media type remains unknown, the recipient SHOULD treat it as type "application/octet-stream". 

Note that in this context "SHOULD" means it's advised but not mandatory. In particular. The receiver is ONLY allowed to guess the type if the media type is missing. Now, IE ignores that rule, but Mozilla does not, which is why the Mozilla engineers wanted so badly for apache to change the setting! Per RFC 2046, "application/octet-stream" actually means "arbitrary binary data" which the application is recommended to simply save (not try to guess the type). ( http://www.ietf.org/rfc/rfc2046.txt section 4.5.1 )

I hope you can allow me to set default_type to None or leave it unset and have nginx send no Content-Type header. Thanks!

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,1577,1577#msg-1577






More information about the nginx mailing list