2

My backend returns different data for some get requests depending on the user's session data. I would like to force angular to not use cache for certain get requests so that it can retrieve the latest data from the server. I have tried a few things but I keep getting back a 304 not modified response when repeating the same get request. Any suggestions on how to fix this?

cnaut
  • 144
  • 1
  • 12
  • HTTP 304 has nothing to do with Angular I suppose, it's Browser behavior. Refer to this [topic](http://webmasters.stackexchange.com/questions/25342/headers-to-prevent-304-if-modified-since-head-requests) about how to prevent 304 – Rebornix Feb 13 '15 at 00:59
  • 3
    Add a random query string behind your url, that takes timestamp as the value. This way, each request will be considered a fresh one – Manish Kr. Shukla Feb 13 '15 at 02:28
  • 1
    Yep, adding time based string ?date=... is easy and works for sure. You can specify cache: false, add headers, etc., but seems IE dont care about it. – Petr Averyanov Feb 13 '15 at 02:39
  • Yep, this was the only method that I could get to work – cnaut Feb 13 '15 at 21:46

0 Answers0