Howto force text type of dir/subdir/file?

Francis Daly 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:

Hi there,

> This works fine when I browse to for example:
> https://<domain>/doc/procmail-3.22/examples/1procmailrc
> 
> But it does not work for:
> 
> https://<domain>/doc/postfix-2.6.6/README_FILES/AAAREADME
> 
> Not work meaning Firefox offers the AAAREADME file for download.

What does

  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.

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list