Satellizer causes Angular to pre-flight ALL of my rest queries with an OPTIONS request-open source projects sahat/satellizer
Yves
After looking through the code and studying Angualr’s httpProvider I realized that Sateliizer is intercepting every single request using httpProvider’s interceptors array and adding the following:
var token = localStorage.getItem(tokenName);
if (token && config.httpInterceptor) {
token = config.authHeader === 'Authorization' ? 'Bearer ' + token : token;
httpConfig.headers[config.authHeader] = token;
}
So that every single request gets an Authorization header. Since I actually have only ONE request that needs an authorization header I modified the conditional statement:
if (token && config.httpInterceptor && httpConfig.auth===true) {
and then in my $http.get for the single service that actually needs authorization I add:
var config = {auth: true};
$http.get(googleUrl, config)