ng-token-auth
ng-token-auth copied to clipboard
Why you added fixed "If-Modified-Since" header?
$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.
Found here https://github.com/lynndylanhurley/ng-token-auth/blob/058bc2bb56ee455c40a53485c2070a8d7df6db2d/src/ng-token-auth.coffee
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"]
)
#324
#340
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.