状态代码200或304?哪一个是正确的?带有S3的Amazon CloudFront

时间:2017-02-19 09:17:59

标签: amazon-web-services amazon-s3 amazon-cloudfront

状态码200是否正常?或304是正常的? 图像是公开的并且是固定的,因此将为每个用户提供365天相同的图像。

当我上传图片时,我在Amazon S3上将Cache-Control设置为max-age = 31536000。

请帮忙。 :)你能检查一下如何正确设置吗?

我想为带宽省钱。

General
Request URL:http://cdn.xxx.com/abcdefg.jpg
Request Method:GET
Status Code:200 OK
Remote Address:54.111.111.11:80


Response Headers
Accept-Ranges:bytes
Age:459753
Cache-Control:max-age=31536000
Connection:keep-alive
Content-Length:83256
Content-Type:image/jpeg
Date:Tue, 14 Feb 2017 00:11:18 GMT
ETag:"5a6cf63186d10eb1fbe161d7de181cc6"
Last-Modified:Thu, 09 Feb 2017 12:45:31 GMT
Server:AmazonS3
Via:1.1 b3825aee9279d95a2a68132ed5dca00f.cloudfront.net (CloudFront)
X-Amz-Cf-Id:J9ncFq1xBjXA4MhF7hxpMIldiR-8aIzjmhAq9tTaT8EaRo54vkbjYQ==
X-Cache:Hit from cloudfront


Request Headers
GET /abcdefg.jpg HTTP/1.1
Host: cdn.xxx.com
Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36
Accept: image/webp,image/*,*/*;q=0.8
Referer: http://cdn.xxx.com/aaaaa
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8,ko;q=0.6
Cookie: _gat=1; _ga=GA1.3.698203739.1486458204

1 个答案:

答案 0 :(得分:0)

304中的状态代码200都可以。所有错误都在400范围内。

200表示OK 304表示Not Modified:客户端可以重用缓存的内容。如果你得到304缓存工作。

查看https://en.wikipedia.org/wiki/List_of_HTTP_status_codes了解详情。