Welcome! Log In Create A New Profile

Advanced

Re: How to config nginx to download html file instead of opening it?

Nick Pearson
August 28, 2009 09:27AM
Make sure the following HTTP header is present:

Content-Disposition: attachment

According to the article at
http://technet.microsoft.com/en-us/library/cc787872%28WS.10%29.aspx
this header will

These changes do not affect cases where a
"Content-disposition=attachment" HTTP header is used
for the file. In those cases, the file name or
extension suggested by the server is considered final
and the file can be executed regardless of
MIME/extension mismatch if the user chooses to accept
the file download prompt.

There are also some meta tags you can use (either in the page or as an
HTTP header) that IE recognizes which will give you more fine-grained
control, but it appears that most of the useful ones weren't
introduced until IE 8. Specifically, X-Content-Type-Options:

http://blogs.msdn.com/ieinternals/archive/2009/06/30/Internet-Explorer-Custom-HTTP-Headers.aspx

Another common solution to this problem is to simply add .txt to the
end of the file names, such as page.html.txt

Nick


On Thu, Aug 27, 2009 at 8:18 PM, jzhang<nginx-forum@nginx.us> wrote:
> Hi All,
> I got into a new problem. The IE browser ignore the mime-type provided by nginx server, and open html document directly.
> From MS's site, it declare IE will use the extension name to detect the mime-type.
>
> Anybody know how to disable IE doing this?
>
> Thanks!
>
> Posted at Nginx Forum: http://forum.nginx.org/read.php?2,5148,5251#msg-5251
>
>
>
Subject Author Posted

How to config nginx to download html file instead of opening it?

jzhang August 25, 2009 04:51AM

Re: How to config nginx to download html file instead of opening it?

J August 25, 2009 05:29AM

Re: How to config nginx to download html file instead of opening it?

Igor Sysoev August 25, 2009 05:46AM

Re: How to config nginx to download html file instead of opening it?

jzhang August 25, 2009 10:25PM

Re: How to config nginx to download html file instead of opening it?

jzhang August 27, 2009 09:18PM

Re: How to config nginx to download html file instead of opening it?

Nick Pearson August 28, 2009 09:27AM

Re: How to config nginx to download html file instead of opening it?

jzhang August 28, 2009 02:09AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 227
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready