several sibling location block
ST
smntov at gmail.com
Tue Jun 13 16:26:30 UTC 2017
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!
More information about the nginx
mailing list