jimmynicol / image-resizer

On-the-fly image resizing using Node.js and GraphicsMagick. Heroku Ready!
MIT License
339 stars 104 forks source link

Last-Modified header is missing? #74

Closed jgillman closed 8 years ago

jgillman commented 8 years ago

I might have something configured incorrectly but I'm not seeing Last-Modified being sent in the response.

Best case they're just missing and that's fine. Worst case it's missing and interpreted as Last-Modified: Thu, 01 Jan 1970 00:00:00 GMT.


At the moment it seems to be screwing up Facebook's bot that grabs images for when a user shares a link. There is an open bug on Facebook where several users (including myself) are having image loading issues that look like they're related to the Last-Modified: Thu, 01 Jan 1970 00:00:00 GMT.

jimmynicol commented 8 years ago

@jgillman take a look at this: https://github.com/jimmynicol/image-resizer/blob/master/src/streams/response.js#L77

So if you are not running dev mode then you will be sending the appropriate headers for caching, which includes the Last-Modified header. It is indeed set to 1/1/1970 which represents Date(0) in unixtime and it would appear that Facebook is being bit by a simple bug that 0 cant represent false.

I will set this expiry to something less annoying.

jimmynicol commented 8 years ago

Try out v1.2.1 for this change.

jgillman commented 8 years ago

Great! Thank you. I'll test it out this week and give a shout if FB isn't happy with it ;)

On Sun, Oct 11, 2015 at 10:22 AM, James Nicol notifications@github.com wrote:

Try out v1.2.1 for this change.

— Reply to this email directly or view it on GitHub https://github.com/jimmynicol/image-resizer/issues/74#issuecomment-147222901 .