ossia
(Quincy Larson)
November 24, 2017, 10:24pm
1
Content type header doesn’t seem to be being sent for images:
Nathaniels-MacBook-Pro:guides nathanielsuchy$ curl -I https://discourse-user-assets.s3.amazonaws.com/original/2X/f/ff5fe6693f4d56b6b6b768d91f10bd4cdd9f3eb2.jpg
HTTP/1.1 200 OK
x-amz-id-2: BQeAIH/MA6a8tB8l3QBpfHle440K8BhaZJVg3hVzvRuhGVMOrZKad4Cmg1YP0BxzOtrmJv/d484=
x-amz-request-id: 66CC116C9EAF7ADE
Date: Fri, 24 Nov 2017 16:44:56 GMT
Last-Modified: Mon, 11 Jul 2016 23:14:30 GMT
ETag: "bd8b44c446245bc7c6ae80f58929c039"
Accept-Ranges: bytes
Content-Type:
Content-Length: 143717
Server: AmazonS3
Is this something you all can fix?
sam
(Sam Saffron)
November 24, 2017, 10:33pm
2
Is this happening here? We also use s3 for images
zogstrip
(Régis Hanol)
November 24, 2017, 11:20pm
3
Well, let’s try
Freshly uploaded image
And the result of curl
$ curl -I "https://d11a6trkgmumsb.cloudfront.net/original/3X/a/a/aa245d9f64088f61ff802a099020cc16bdc2e893.png"
HTTP/1.1 200 OK
x-amz-id-2: bscfyxGyfnatR3c/HNS68xSQYNmA+H/0NYkFjpl3W/7Os8xEV1qm/xgl1unPCq2kJ4Feha/TfXc=
x-amz-request-id: 1AFD0B0CE8E779F0
Last-Modified: Fri, 24 Nov 2017 23:20:28 GMT
ETag: "175a532c21a4beee8788a3354435443b"
Content-Type: image/png
Server: AmazonS3
Content-Length: 11048
Accept-Ranges: bytes
Date: Fri, 24 Nov 2017 23:20:54 GMT
Via: 1.1 varnish
Age: 21
Connection: keep-alive
X-Served-By: cache-lhr6333-LHR
X-Cache: HIT
X-Cache-Hits: 1
X-Timer: S1511565654.090461,VS0,VE0
We can’t repro this, can you provide more info on how to repro?
nsuchy
(Nathaniel Suchy)
November 25, 2017, 12:32am
5
It affects the url https://discourse-user-assets.s3.amazonaws.com/
which is on Amazon S3 not fastly. The content-type
header isn’t set for images which can cause issues for certain http clients and even old web browsers.
ok @supermathie can you have a look?
supermathie
(Michael Brown)
November 25, 2017, 4:19am
7
It isn’t exactly the same test, correct, but accessing our storage bucket directly gives us:
○ → curl -I https://our-image-bucket.s3.amazonaws.com/original/3X/a/a/aa245d9f64088f61ff802a099020cc16bdc2e893.png
HTTP/1.1 200 OK
x-amz-id-2: DYBpZmyTRqNu3mmkXIjj4af219I8fPRUZHr/2UBkZJUZeKIp5VWGB2aKp40Zu3WahOZv2d8YmoY=
x-amz-request-id: F9FAD938C3224974
Date: Sat, 25 Nov 2017 04:10:10 GMT
Last-Modified: Fri, 24 Nov 2017 23:20:28 GMT
ETag: "175a532c21a4beee8788a3354435443b"
Accept-Ranges: bytes
Content-Type: image/png
Content-Length: 11048
Server: AmazonS3
Correct Content-Type
header. But again, not exactly the same test (png vs jpg).
Uploading your image to our bucket (via the normal file upload interface) gives:
○ → curl -I https://our-image-bucket.s3.amazonaws.com/original/3X/f/f/ff5fe6693f4d56b6b6b768d91f10bd4cdd9f3eb2.jpg
HTTP/1.1 200 OK
x-amz-id-2: fWPylnc9MqXMNNObA9sRDhqLe9XoebpyAOsKkpCrHvR12PDKLiV6ABnH3sSXyEREjXgrkOLhjYM=
x-amz-request-id: 732D89FA7CB07398
Date: Sat, 25 Nov 2017 04:12:03 GMT
Last-Modified: Sat, 25 Nov 2017 04:11:40 GMT
ETag: "bd8b44c446245bc7c6ae80f58929c039"
Accept-Ranges: bytes
Content-Type: image/jpeg
Content-Length: 143717
Server: AmazonS3
So it’s behaving correctly for us. Given that the upload date of your file seems to be roughly a year and a half ago it’s possible this used to be a problem but has now been fixed. Do newly uploaded images show the same behaviour?
3 Likes
nsuchy
(Nathaniel Suchy)
November 25, 2017, 6:13pm
8
I can confirm that new image uploads are not affected by this bug. By any chance are you guys are to iterate over all of the old images and assign a mime type where one is not already specified? Very minor issue, still a concern.
Nathaniels-MacBook-Pro:guides nathanielsuchy$ curl -I https://discourse-user-assets.s3.amazonaws.com/optimized/3X/f/7/f7d38ba6d57f5b7f38c969a1664e55bc44051577_1_690x260.png
HTTP/1.1 200 OK
x-amz-id-2: ColUVeLl1IMT4RCxnt06qGqVIgVhlu89w+ADfg5geELDn72MuBicjrRYQ5YAVY3VAFFk6au2B3M=
x-amz-request-id: E9BEAA7CB435DA75
Date: Sat, 25 Nov 2017 18:11:06 GMT
Last-Modified: Fri, 24 Nov 2017 22:18:25 GMT
ETag: "35f8328b45f6cb0aeb372bf448abc4c2"
Accept-Ranges: bytes
Content-Type: image/png
Content-Length: 40401
Server: AmazonS3
2 Likes