Welcome! Log In Create A New Profile

Advanced

several sibling location block

ST
June 13, 2017 12:28PM
Hello,

I try to convert following apache related stuff:

# force download for ceratain file types
<FilesMatch "\.(?i:fb2|mobi|mp3)$">
Header set Content-Disposition attachment
</FilesMatch>
<FilesMatch "\.(?:fb2)$>
Header set Content-type text/fb2+xml
</FilesMatch>
<FilesMatch "\.(?:mobi)$>
Header set Content-type application/x-mobipocket-ebook
</FilesMatch>
<FilesMatch "\.(?:mp3)$>
Header set Content-type audio/mpeg
</FilesMatch>

to nginx, as follows:


location / {

# force download for ceratain file types
location ~* \.(?:fb2|mobi|mp3)$ {
add_header Content-Disposition "attachment";
}
location ~* \.fb2$ {
add_header Content-type "text/fb2+xml";
}
location ~* \.mobi$ {
add_header Content-type "application/x-mobipocket-ebook";
}
location ~* \.mp3$ {
add_header Content-type "audio/mpeg";
}

....
}

Content-Disposition "attachment" seems to be added properly to the
header, however not the Content-type. Why? Can several sibling location
blocks that match be proceeded or only one?

Thank you!

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

several sibling location block

ST June 13, 2017 12:28PM

Re: several sibling location block

Ingo Schmidt June 14, 2017 05:04PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 255
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