AngularJS not detecting Access-Control-Allow-Origin header? AngularJS not detecting Access-Control-Allow-Origin header? angularjs angularjs

AngularJS not detecting Access-Control-Allow-Origin header?


It's a bug in chrome for local dev. Try other browser. Then it'll work.


There's a workaround for those who want to use Chrome. This extension allows you to request any site with AJAX from any source, since it adds 'Access-Control-Allow-Origin: *' header to the response.

As an alternative, you can add this argument to your Chrome launcher: --disable-web-security. Note that I'd only use this for development purposes, not for normal "web surfing". For reference see Run Chromium with Flags.

As a final note, by installing the extension mentioned on the first paragraph, you can easily enable/disable CORS.


I was sending requests from angularjs using $http service to bottle running on http://localhost:8090/ and I had to apply CORS otherwise I got request errors like "No 'Access-Control-Allow-Origin' header is present on the requested resource"

from bottle import hook, route, run, request, abort, response#https://github.com/defnull/bottle/blob/master/docs/recipes.rst#using-the-hooks-plugin@hook('after_request')def enable_cors():    response.headers['Access-Control-Allow-Origin'] = '*'    response.headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS, PUT'    response.headers['Access-Control-Allow-Headers'] = 'Origin, X-Requested-With, Content-Type, Accept'