0

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

Deleadon
  • 1
  • 2

1 Answers1

0

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.

Katana24
  • 8,706
  • 19
  • 76
  • 118