0

I need to make a get request to this url: http://action.metaffiliation.com/trk.php?mclic=N4CD1F1015&argann=test

when I do it via curl curl 'http://action.metaffiliation.com/trk.php?mclic=N4CD1F1015&argann=test' everything works fine, I do get the GIF object I'm expecting.

When I run this get request using $http.get using AngularJS, it first runs an OPTIONS request that fails.

I've checked MDN HTTP access control (CORS) and have added what I think are the correct headers to make a simple request:

$http.get('http://action.metaffiliation.com/trk.php?mclic=N4CD1F1015&argann=test', {
        headers: {'Accept': 'image/webp,image/*,*/*;q=0.8', 
        'Content-Type': 'text/plain',
        'Cache-Control': 'no-cache'}
});

Still no luck.

any idea ? P.S: the url that I'm hitting is supposed to be called in a img tag

thanks

sideshowbarker
  • 81,827
  • 26
  • 193
  • 197
Mike W
  • 391
  • 4
  • 14
  • Did you observe, you are missing the 'http' protocol.. – Vidya Sagar Apr 05 '16 at 07:30
  • I have but it doesn't change anything. Also what I forgot to mention : I don't have access to the server I'm trying to reach – Mike W Apr 05 '16 at 07:32
  • It should be `$http.get('http://action.metaffiliation.com/trk.php?mclic=N4CD1F1015&argann=test', ...` – Vidya Sagar Apr 05 '16 at 07:34
  • I know I've tried it too, it doesn't change anything, I'll update my question – Mike W Apr 05 '16 at 07:35
  • Have a look at my answer over here: http://stackoverflow.com/questions/30254277/angular-http-is-sending-options-instead-of-put-post/30328731#30328731 – ohboy21 Apr 05 '16 at 07:46
  • thanks @gruberb the problem in this case is that A/ it's a GET request, B/ I can't do anything on the server I'm trying to reach – Mike W Apr 05 '16 at 07:55
  • @MikeW you definetly have to talk to your backend people how the request has to look like to get accepted. If you are using a public API, read the docs. – ohboy21 Apr 05 '16 at 09:35
  • @gruberb thanks a lot for your help. I don't think it has to do with the distant server tho, cause I'm pretty sure the options request doesn't even reach the distant server – Mike W Apr 05 '16 at 09:36

1 Answers1

0

ARRGHHHH. This was just coming from the fact that I had an ad blocker turned on ! Sorry for the inconvenience, and thanks a lot for your help

Mike W
  • 391
  • 4
  • 14