0

I'm using Wamp as my local server while I test my Angular app.

I am using $resource to get some api data from my server but I'm getting a message

    XMLHttpRequest cannot load http://myproj.herokuapp.com/api/projects?name=demo.
 No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access. The response had HTTP status code 401.

I've searched far and wide on the web but I cannot find a working way to get around this.

Any new fresh ideas? Has anyone overcome this issue?

CodyBugstein
  • 21,984
  • 61
  • 207
  • 363

1 Answers1

0

how to allow ACCESS-CONTROL-ALLOW-ORIGIN aka cross-domain on wampserver

This author got it right.
"You have to enable the headers module first, like so :

click on the wamp icon in your systray go to Apache > Apache modules check the option 'headers_module' And then include this in your apache config:

Header set Access-Control-Allow-Origin: * (in httpd.conf or in the configuration of your vhost)

(Instead of the * you can also specify a specific domain)"

Then bring up your browser, and use localhost/filename to access your files.

Fredz
  • 19
  • 6