-
Notifications
You must be signed in to change notification settings - Fork 27.4k
$http GET turns into OPTIONS #1585
Comments
I think it is not a place too ask such questions but anyway it would be very helpful if you provided the request headers and response headers for the OPTIONS request that is issued. |
If I didn't think that it might be a bug I would have probably posted it on google group Access-Control-Request-Headers:origin, x-requested-with, accept thanks for replying |
Is this related to #1454 and On 16 November 2012 10:59, grumpyOldRussian notifications@github.comwrote:
|
Almost certainly. Try the workaround in pull #1454. |
@alexeygolev Could you try to remove the It is kind of hard to help on this one without more info. Is your app available anywhere on-line? Did you try sniffing HTTP traffic to be sure that a request doesn't leave a browser? |
Was already doing that. For the record, I was opening a local file and having it try to open another local file. |
@alexeygolev just for the record - what is a browser we are talking about here? Is it, by any chance, IE? |
Oh, sorry. I didn't realize you weren't talking to me. :) |
@alexeygolev haven't heard from you and it really next to impossible to help more without knowing what is going on in your browser / server. Would love to help more but there are just not enough data. Going to close this one for now, please re-open or post something on the mailing list / IRC when you've got more info. |
here is a great example for this. $http.get("http://cdn.api.twitter.com/1/urls/count.json?url=www.google.com&callback=?") but this works |
This is still going on. |
@yarivdev - normally GET requests are converted to OPTION requests if you are trying to access a resource outside of the current domain. This is part of the CORS spec. |
how come it doesn't happen with $.getJson? Sent from my iPhone
|
Probably a different set of HTTP headers is sent. Once again, OPTIONS requests are sent by a browser, Angular has no control over it. If you compare behaviour of jQuery and AngularJS make sure that you compare all the properties of a request (full URL, request headers, request body etc.). Impossible to say more based on the info provided. If you still believe that AngularJS does something wrong here, please open a new issue with a clear steps to reproduce (Plunker). |
@yarivdev, see the link that @franklovecchio posted
|
0 i do not know if any body still interested in this topic but i am going to tell you my approach i added CORS Options to web config file in my api project and then add [HttpOptions] attribute to my api method and then it started working i do not know if it is the right answer or not but until i find the better solution i am going to user this approach |
Even taking all the client side and server side issues of CORS into account I'm still not managing to make it work.
This works
however this doesn't
The latter turns GET request into pending OPTIONS request. What am I missing? It can't be a bug can it?
The text was updated successfully, but these errors were encountered: