1

I have two MEAN Stack applications running on my local computer. One is client app running on port 88 and second application is server app that is running on port 99. I just wanted to call API of server app from my client app. I used $http in my angular controller.

But it is giving me error like

" XMLHttpRequest cannot load localhost:99/path/to/the/API. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource. angular.js:11607 Error: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'localhost:99/path/to/the/API'.at Error (native)".

I tried with delete $httpProvider.defaults.headers.common['X-Requested-With'];
$httpProvider.defaults.useXDomain = true;

in my angular app. but still getting the same issue. Also tried with CORS but still getting the same error.

1 Answers1

0

I had the same issue and solved it by prefixing the url localhost:5000/api/ with http, so http://localhost:5000/api/ did the trick.

Sean
  • 1
  • 2