I'm building a web server distributing variety kind of binary files. (with Ubuntu) They have vary extensions and sometimes has wrong extension. But currently, my Apache server serves unknown files as text. So I have to make my Apache2 serve all files as binary by default regardless of extension or any metadata except some explicit cases. How can I archive this?
Asked
Active
Viewed 5,935 times
1 Answers
3
Try this directive on your site configuration:
DefaultType application/octet-stream
Or this one:
DefaultType None
The default seems to be text/plain:
DefaultType Directive
Description: MIME content-type that will be sent if the server cannot determine a type in any other way
Syntax: DefaultType MIME-type|none
Default: DefaultType text/plain
Context: server config, virtual host, directory, .htaccess

Eduardo Ivanec
- 14,881
- 1
- 37
- 43
-
This is correct, but I'll add two points: one, don't test with Internet Explorer, which tries to guess content types; use Firefox (or another decent browser). Also, DefaultType None should be the default configuration; check to make sure you aren't overriding this elsewhere. – BMDan May 02 '11 at 04:27
-
I thought the same but the docs seem to point to text/plain as the default, see edit. – Eduardo Ivanec May 02 '11 at 10:43