ajbrown / angular-loggly-logger

An AngularJS module which sends your $log message to loggly, and provides a service for manually sending messages to loggly.
MIT License
32 stars 49 forks source link

Error when using $httpProvider.defaults.withCredentials = true #41

Closed milosh012 closed 8 years ago

milosh012 commented 8 years ago

Hi,

There is a problem with CORS when using your library and withCredentials mode is on. Im using angular ver 1.4

Here is error message:

XMLHttpRequest cannot load https://logs-01.loggly.com/inputs/XXX/tag/AngularJS/. A wildcard '*' cannot be used in the 'Access-Control-Allow-Origin' header when the credentials flag is true. Origin 'http://localhost:9000' is therefore not allowed access. The credentials mode of an XMLHttpRequest is controlled by the withCredentials attribute.

So the solution is very easy. Just need to add withCredentials: false in your $http config object.

I can do a PR if you want, or you will do it?

Best, Milos

ajbrown commented 8 years ago

@milosh012 , thanks for pointing that out. Go ahead and open a pull request and I'll get it merged in. Make sure you target the develop branch

milosh012 commented 8 years ago

@ajbrown Great!, here is PR https://github.com/ajbrown/angular-loggly-logger/pull/42

ajbrown commented 8 years ago

Released with v0.2.2

Olgagr commented 8 years ago

@ajbrown Can you make version 0.2.2 available through npm ? I also have the same problem with CORS and I'm using npm for my dependencies.

ajbrown commented 8 years ago

@Olgagr all done. Sorry about that, It used to auto publish when new tags were added. I'm not sure when this changed.

Olgagr commented 8 years ago

@ajbrown One more question: do you think it could be possible for npm package to remove bower as dependency ? Right now, when I install package through npm, the postinstall is called, then bower install that installs angular, angular-loader etc. This is problematic. For example, I couldn't install angular-loggly-logger during my CI process (I use Jenkins for CI) because Jenkins didn't know what to do with 'bower install' command.