javascript - CORS when both client & server are localhost? -
i trying develop client/server app angluarjs & php (which ajax handles http , never displays page in browser).
i use xampp apache localhost , develop client in brackets ide. brackets runs "live preview" on local host port 49883.
[update] chooses new port after each reboot, if want align apache that, have manually edit config after each reboot (ick).
when try $http.get('http://127.0.0.1/my_script.php?action=overview_map&date=2014-04-12&user=abc')
the debug console shows.
no 'access-control-allow-origin' header present on requested resource. origin 'http://127.0.0.1:49833' therefore not allowed access.
how can around this?
i put line in windows hosts file 127.0.0.1 test_site
, in php
header('access-control-allow-origin: test_site'
still the 'access-control-allow-origin' header contains invalid value 'test_site'.
perhaps there way brackets start chrome --disable-web-security
option, have no cors problems @ all?
or (free) ide handles this?
this new me, there must many, many, many others out there developing client & server (preferably js & php) on localhost. how do it?
thanks in advance help.
you're using different port. subject cors.
Comments
Post a Comment