imgflo / imgflo-server

HTTP image processing server based on imgflo
48 stars 7 forks source link

Images sometimes served as application/octet-stream #42

Closed jonnor closed 8 years ago

jonnor commented 8 years ago

Causes web-browsers to download the image when doing 'open image in new tab'.

Reported by @forresto

jonnor commented 8 years ago

Most obvious difference is the time image was uploaded/processed, as seen by Last-Modified header. Needs verification on more images though. Could be regression in imgflo or changes in Amazon S3. Should have tests for the content-type of served images.

[jon@jon-laptop ~]$ wget --server-response 'https://imgflo.herokuapp.com/graph/vahj1ThiexotieMo/628d3bd8499b0dec66d4865cd946ade7/passthrough.jpg?input=http%3A%2F%2Fkarenswhimsy.com%2Fpublic-domain-images%2Fgreek-goddess%2Fimages%2Fgreek-goddess-3.jpg&width=400&height=685'

--2015-09-10 16:37:19-- https://imgflo.herokuapp.com/graph/vahj1ThiexotieMo/628d3bd8499b0dec66d4865cd946ade7/passthrough.jpg?input=http%3A%2F%2Fkarenswhimsy.com%2Fpublic-domain-images%2Fgreek-goddess%2Fimages%2Fgreek-goddess-3.jpg&width=400&height=685 Resolving imgflo.herokuapp.com (imgflo.herokuapp.com)... 107.20.178.133 Connecting to imgflo.herokuapp.com (imgflo.herokuapp.com)|107.20.178.133|:443... connected. HTTP request sent, awaiting response... HTTP/1.1 301 Moved Permanently Server: Cowboy Connection: keep-alive X-Powered-By: Express Location: https://s3-us-west-2.amazonaws.com/the-grid-img/p/ff2c0c4a02c8d554d48080a5410f854155cccf7d.jpg Date: Thu, 10 Sep 2015 14:39:02 GMT Transfer-Encoding: chunked Via: 1.1 vegur Location: https://s3-us-west-2.amazonaws.com/the-grid-img/p/ff2c0c4a02c8d554d48080a5410f854155cccf7d.jpg [following] --2015-09-10 16:37:19-- https://s3-us-west-2.amazonaws.com/the-grid-img/p/ff2c0c4a02c8d554d48080a5410f854155cccf7d.jpg Resolving s3-us-west-2.amazonaws.com (s3-us-west-2.amazonaws.com)... 54.231.176.2 Connecting to s3-us-west-2.amazonaws.com (s3-us-west-2.amazonaws.com)|54.231.176.2|:443... connected. HTTP request sent, awaiting response... HTTP/1.1 200 OK x-amz-id-2: 8pXRjejAY11s8rSNfJrM0YuUMcsguQIkhsGF4GR5dex/pi40/WjlL25boJoMI9nj0K/XT7VI84Q= x-amz-request-id: 15F86FC597EA5BA4 Date: Thu, 10 Sep 2015 14:39:04 GMT Cache-Control: max-age=86400 Last-Modified: Thu, 11 Jun 2015 22:32:44 GMT ETag: "2c2ee69ad954bb398f6e17e073bfc43d" Accept-Ranges: bytes Content-Type: image/jpeg Content-Length: 66207 Server: AmazonS3 Length: 66207 (65K) [image/jpeg]

[jon@jon-laptop ~]$ wget --server-response 'https://imgflo.herokuapp.com/graph/vahj1ThiexotieMo/6fb158bdde67cbf505a54785ea480e76/passthrough.jpg?input=http%3A%2F%2Fthe-grid-user-content.s3-us-west-2.amazonaws.com%2Ffa907178-240c-4ac3-8505-73f512c287bd.jpg&width=1574&height=337'

--2015-09-10 16:35:10-- https://imgflo.herokuapp.com/graph/vahj1ThiexotieMo/6fb158bdde67cbf505a54785ea480e76/passthrough.jpg?input=http%3A%2F%2Fthe-grid-user-content.s3-us-west-2.amazonaws.com%2Ffa907178-240c-4ac3-8505-73f512c287bd.jpg&width=1574&height=337 Resolving imgflo.herokuapp.com (imgflo.herokuapp.com)... 107.20.190.74 Connecting to imgflo.herokuapp.com (imgflo.herokuapp.com)|107.20.190.74|:443... connected. HTTP request sent, awaiting response... HTTP/1.1 301 Moved Permanently Server: Cowboy Connection: keep-alive X-Powered-By: Express Location: https://s3-us-west-2.amazonaws.com/the-grid-img/p/98ac59c081fe423d21cda4c095ebf515bc5ffc80.jpg Date: Thu, 10 Sep 2015 14:36:53 GMT Transfer-Encoding: chunked Via: 1.1 vegur Location: https://s3-us-west-2.amazonaws.com/the-grid-img/p/98ac59c081fe423d21cda4c095ebf515bc5ffc80.jpg [following] --2015-09-10 16:35:10-- https://s3-us-west-2.amazonaws.com/the-grid-img/p/98ac59c081fe423d21cda4c095ebf515bc5ffc80.jpg Resolving s3-us-west-2.amazonaws.com (s3-us-west-2.amazonaws.com)... 54.231.176.10 Connecting to s3-us-west-2.amazonaws.com (s3-us-west-2.amazonaws.com)|54.231.176.10|:443... connected. HTTP request sent, awaiting response... HTTP/1.1 200 OK x-amz-id-2: yL8beVfgwX6tCh5ugjiUbL5j9LcBS2WKyGs8e8sSYhHlKb5goJpbGVi0+818n/mHoMPs7RwG14Y= x-amz-request-id: 087AA54A918E7823 Date: Thu, 10 Sep 2015 14:36:55 GMT Cache-Control: max-age=86400 Last-Modified: Mon, 31 Aug 2015 15:06:54 GMT ETag: "ec52373546da29bcfcf62e3153f41aad" Accept-Ranges: bytes Content-Type: application/octet-stream Content-Length: 231722 Server: AmazonS3 Length: 231722 (226K) [application/octet-stream]

jonnor commented 8 years ago

Note that old cached images will still have wrong/generic content-types still.