简体   繁体   中英

Images disappear on refresh in heroku-hosted rails application

Let me say first that I'm quite new and inexperienced with rails. Today I tried to update an image in a rails app hosted on Heroku. Anyway, this is the simple flow I followed as I did other times before:

  1. Add updated image to the image folder
  2. Precompile the assets rake assets:precompile
  3. Add and commit all changes
  4. Push to heroku

Until this point all seems fine: I open Chrome to check my app from my domain and it's all there as expected.

The problem is that if I refresh the page all the images disappear (like they have never been loaded). This does not happen locally. If I do a ctrl+f5 it all comes back nicely, but I lose everything again on simple refresh.. and so on.

Has anyone experienced something similar? I understand this might be hard to answer as there is not much code to show. Let me know if I can give more details.

On a final note, it seems that all works normally on a friends machine (that is, refresh doesn't give this problem). I'm thinking something might be wrong with my Chrome settings here? I don't remember having changed anything recently though.

This is very weird and quite annoying some help/insights would be great.

UPDATE: This seems indeed really to happen locally on my machine at work. I checked from another couple of computers at home and the app is displayed fine (without any refreshing problem).

Did you check if the cookie is disabled by your browser for the heroku website in particular?

I have just tested this issue with an image based website ( https://unsplash.com/ ). When the cookie is disabled for that website, pressing F5 clears all the images, while pressing Ctrl-F5 brings those lost resources back as like as your case.

Enabling cookie resolves the issue in my case.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM