Skip to content

Instantly share code, notes, and snippets.

@Jamp
Created June 27, 2019 01:45
Show Gist options
  • Save Jamp/9da06cd95fcb529a4a7d8995b128c889 to your computer and use it in GitHub Desktop.
Save Jamp/9da06cd95fcb529a4a7d8995b128c889 to your computer and use it in GitHub Desktop.
Serve all PDF Files on S3 with Nginx and Proxy Reverse(remember give public access on files en S3)
location ~ \.pdf {
try_files $uri $uri/ @aws;
}
location @aws {
proxy_pass https://<bucket_name>.s3.amazonaws.com;
proxy_set_header Host "<bucket_name>.s3.amazonaws.com";
proxy_set_header Authorization '';
proxy_hide_header x-amz-id-2;
proxy_hide_header x-amz-storage-class;
proxy_hide_header x-amz-request-id;
proxy_hide_header Set-Cookie;
proxy_ignore_headers "Set-Cookie";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment