Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why you added fixed "If-Modified-Since" header? #325

Open
dobryakov opened this issue Sep 22, 2016 · 5 comments
Open

Why you added fixed "If-Modified-Since" header? #325

dobryakov opened this issue Sep 22, 2016 · 5 comments

Comments

@dobryakov
Copy link

dobryakov commented Sep 22, 2016

$httpProvider.defaults.headers[method]['If-Modified-Since'] = 'Mon, 26 Jul 1997 05:00:00 GMT'

Why? What this date means? Is it your birthday?

Do you understand how it affects on HTTP caching? You have totally broken all browser caching mechanism. The browser should have an ability to decive what to cache or not, and the server can answer with 200 (content) or 304 (without content) depends on real datetime in this header.

@dobryakov
Copy link
Author

Solution for globally disable this behaviour:

app/scripts/app.coffee

httpMethods = ['get', 'post', 'put', 'patch', 'delete']
angular.forEach(httpMethods, (method) ->
  $httpProvider.defaults.headers[method] ?= {}
  delete $httpProvider.defaults.headers[method]["If-Modified-Since"]
)

@svlapin
Copy link

svlapin commented Sep 22, 2016

#324

@merqlove
Copy link
Contributor

#340

@mxmzb
Copy link

mxmzb commented Feb 1, 2017

holy moly, this cost me so much brain damage actually. this lets you run into wall when you do any other requests than to the api you are authenticated with.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants