I am experiencing an issue with the $http service.
I have an php-server on an other localhost ip-address which serves as REST-API. I tried this connection with some $http.get()
requests and everything worked fine, but it seems like something is blocking my delete
or put
requests. I tried to configure my http-requests with the $httpProvider
$httpProvider.defaults.useXDomain = true;
delete $httpProvider.defaults.headers.common['X-Requested-With'];
But this didn't worked either. I read that this is in most cases a server-issue but I had no problems to connect to the server using postman.
The Warning I get in the firefox-console is:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:8000/testUrl (Reason: CORS preflight channel did not succeed).
I didn't found any similar issues through google for the newest version of angular. It might be possible that the usage of $httpProvider
is deprecated since 1.2.
Kind regards,
Deleadon
I personally use this in Chrome to turn CORS on and off:
https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi
Simple UI - when it's green you know that CORS is on, when red you know that it's off.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.