Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

Set Cache-Control header for Amazon S3 uploaded images to prevent browsers from requesting images everytime.

Daniel Granafade1730ceeb
diff --git a/scrapy/trunk/scrapy/contrib/pipeline/s3images.py b/scrapy/trunk/scrapy/contrib/pipeline/s3images.py
index d2f2a308e..6aa7cfec3 100644
--- a/scrapy/trunk/scrapy/contrib/pipeline/s3images.py
+++ b/scrapy/trunk/scrapy/contrib/pipeline/s3images.py
@@ -154,6 +154,7 @@ class S3ImagesPipeline(BaseImagesPipeline):
'X-Amz-Acl': 'public-read',
'X-Amz-Meta-Width': str(width),
'X-Amz-Meta-Height': str(height),
+ 'Cache-Control': 'max-age=172800',
}
buf.seek(0)