With AngularJS interceptors, is it possible to differentiate my app calls to $http (direct either through $resource) from requests made by Angular itself for static resources, like views, without checking URLs?
I'm adding custom authorization header in HTTP interceptor like this:
transparentAuthServices.factory('authHttpInterceptor',
function (localSessionStorage) {
return {
'request': function (config) {
if (!config.ignoreAuthInterceptor && localSessionStorage.hasSession()) {
var sessionId = localSessionStorage.getSession().sessionId;
config.headers['Authorization'] = 'ARTAuth sessionId="' + sessionId + '"';
return config;
} else {
return config;
}
}
}
};
});
It works fine but I don't need authorization for static resources and my server doesn't check them. I could check URLs and skip on those starting with '/app' (in my case) but I wonder is there an elegant solution?