From 7a26c082146c3d6520d9eede4c8404a566bb35b0 Mon Sep 17 00:00:00 2001 From: Edu Herraiz Aparicio Date: Mon, 21 Nov 2016 10:50:28 +0100 Subject: [PATCH] add-header with if necessary inside location --- nginx/nginx.conf | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/nginx/nginx.conf b/nginx/nginx.conf index b1007698..7812b3e0 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -58,13 +58,12 @@ http { add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS'; add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Mx-ReqToken,X-Requested-With'; - # This hack to add header Content-Disposition will be deleted if envvar THUMBOR_ALLOW_CONTENT_DISPOSITION != true - if ($args ~* download){ add_header 'Content-Disposition' 'attachment'; } - location ~* "^/(..)(..)(.+)?$" { root /data/result_storage/v2/$1/$2; expires 1M; error_page 404 = @fetch; + + if ($args ~* download){ add_header 'Content-Disposition' 'attachment'; } # This hack to add header Content-Disposition will be deleted if envvar THUMBOR_ALLOW_CONTENT_DISPOSITION != true } location = /healthcheck { @@ -75,6 +74,8 @@ http { location @fetch { internal; proxy_pass http://thumbor$request_uri; + + if ($args ~* download){ add_header 'Content-Disposition' 'attachment'; } # This hack to add header Content-Disposition will be deleted if envvar THUMBOR_ALLOW_CONTENT_DISPOSITION != true } location ~ /\.ht { deny all; access_log off; error_log off; }