Skip to content

Instantly share code, notes, and snippets.

@kaiinui
Created June 7, 2014 06:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kaiinui/9036689160ff6f8d7f71 to your computer and use it in GitHub Desktop.
Save kaiinui/9036689160ff6f8d7f71 to your computer and use it in GitHub Desktop.
add content-type in Varnish/S3. placehold fix since S3 doesn't set Cache-Control and proper Content-type
sub vcl_fetch {
remove beresp.http.Cache-Control;
set beresp.http.Cache-Control = "public, max-age=31600000";
if (req.url ~ ".jpg$") {
set beresp.http.content-type = "image/jpeg";
}
if (req.url ~ ".webp$") {
set beresp.http.content-type = "image/webp";
}
return(deliver);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment