-
Notifications
You must be signed in to change notification settings - Fork 27.4k
removing X-Requested-With header to do CORS still does not work with koa #8272
Comments
@sallespro removing X-Requested-With header in v1.2.12 won't change anything as this header is not sent by default. What you need to do is to configure your server to respond to the pre-flight CORS requests, background information here: http://www.html5rocks.com/en/tutorials/cors/ Quick google for cors, angularjs and koa brings many results and more importantly, those resources: In any case this is more a support question about backend-configuration and not a problem with AngularJS so I'm going to close this one for now. Support questions like this are better directed to one of those channels: Would be happy to re-open if you still believe that there is a bug in AngularJS and can provide a minimal reproduce scenario. Thnx! |
thanks for indicating the koa-cors resources, i am currently using it in the backend. i was surprised to see this X-Request-With issues around CORS and $http, and having attemped basically all this alternatives : setting headers manually in the request, changing $httprovider defaults at .config, changing the request at runtime with transformRequest, i do not know what to do. The backend is responding nicely to a simple GET with ( http://requestmaker.com/ ). what could i possibly do ? |
@sallespro I would start by comparing headers sent by http://requestmaker.com/ to the ones sent by your app. But yes, you should really try to isolate your scenario (the exact HTTP request / response with headers - for now it is not even clear what is the HTTP method that is failing) and ask this question on one of the support channels. |
hi pawel, i have followed your instructions and look forward getting over this issue. i have compared the headers from requestmaker and a way to replicate. you can replicate the problem and see the error below
this issue #7910 called my attention too, because that is a bit of what it looks like, some herders being merged and not really working... |
Your server is not responding with Access-Control-Allow-Origin. The client doesn't send |
Hi jEFF, thanks for joining. i didn't really understand what you meant. |
Yes, of course |
i see, what headers should i send to make the request successfully ? |
At the very least, |
currently, the chrome browser sends this headers, which seem to be ok, except for not including the Authorization...why that happens ? it looks like despite including in the $http request config object, the actual request does NOT include it.
|
You're still trying to send |
yes, indeed. But the server is responding fine if the client request is made by this third party site. It is NOT a problem with the server not responding accordingly. the question is why $http request does not include the Authorization header ? |
Because you didn't read the rest of the article I linked you to. You need to add |
Can't seem to be able to do CORS with koa backend and $http from angular ( v1.2.12 ).
#1004
The text was updated successfully, but these errors were encountered: