Howto force text type of dir/subdir/file?
francis at daoine.org
Wed May 29 22:37:18 UTC 2013
On Wed, May 29, 2013 at 04:35:03PM +0200, Patrick Lists wrote:
> This works fine when I browse to for example:
> But it does not work for:
> Not work meaning Firefox offers the AAAREADME file for download.
curl -I https://<domain>/doc/postfix-2.6.6/README_FILES/AAAREADME
show as the Content-Type?
If it is "text/plain", your nginx is doing what you told it to do.
Strictly, I suspect that the file is not text/plain, since the control
characters are not normally printable.
So Firefox is probably right to indicate that it is unable to present
the file contents correctly, since they do not match the declared type.
> # file AAAREADME
> AAAREADME: ASCII text, with overstriking
I've just tested on a different server, using a file which "file"
identifies in that same way. The Content-Type: header is text/plain.
> Anyone have a hint what I am doing wrong?
My guess is: claiming that a non-text/plain file is text/plain. nginx
doesn't care; it just does what it is told. Firefox does care.
The simplest thing is probably for you to edit the file to make it be
text/plain. And do the same for any other similar file.
"overstriking" is usually having the three character sequence X ^H X
instead of the single X. So remove the ^H and one X each time, and you
should have a real text/plain file.
And perhaps invite whoever put the file there to only use plain text in
the next version of the package.
Francis Daly francis at daoine.org
More information about the nginx