Skip to content

Instantly share code, notes, and snippets.

@chrisvanpatten
Created September 1, 2012 14:46
Show Gist options
  • Select an option

  • Save chrisvanpatten/3575736 to your computer and use it in GitHub Desktop.

Select an option

Save chrisvanpatten/3575736 to your computer and use it in GitHub Desktop.
nginx proxy_pass uploads
location ~* \.(?:ico|gif|jpe?g|png)$ {
try_files $uri $uri/ @s3;
expires 8h;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
location @s3 {
expires 8h;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
proxy_cache_methods GET HEAD;
proxy_pass_request_body off;
proxy_set_header Content-Length 0; # prevent big POST-style requests to S3
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://your.s3domain.com;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment