Created
March 9, 2015 06:50
-
-
Save mylesjao/604f6e873d04c59a9835 to your computer and use it in GitHub Desktop.
nginx force download
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# attachment directory | |
location /attachment/ { | |
alias /tmp/attachment/; | |
types { } | |
default_type application/octet-stream; | |
if ($request_filename ~ "^.*/(.+\.png|jpg|gif)$"){ | |
set $fname $1; | |
add_header Content-Disposition 'attachment; filename="$fname"'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment