There are several questions related to this but this use case is slightlt different.
In Rails - In my controller I set response header explicitly :
response.headers['X-Accel-Redirect'] = "some_url"
Nginx Config
location ~* ^/some_url/(.*){
set $s3_bucket '$arg_bucket_name';
set $aws_access_key 'AWSAccessKeyId=$arg_AWSAccessKeyId';
set $url_expires 'Expires=$arg_Expires';
set $url_signature 'Signature=$arg_Signature';
set $url_full '$1?$aws_access_key&$url_expires&$url_signature';
proxy_hide_header Content-Disposition;
add_header Content-Disposition 'attachment; filename=$arg_filename';
proxy_hide_header x-amz-id-2;
proxy_hide_header x-amz-request-id;
proxy_buffering off;
proxy_intercept_errors on;
resolver 4.2.2.2 8.8.8.8 valid=300s;
proxy_pass https://$s3_bucket/$url_full;
}
Using this to download 100 of files through nginx ,in few cases I am getting error
SignatureDoesNotMatch
The request signature we calculated does not match with the signature you provide.
Aucun commentaire:
Enregistrer un commentaire