angularjs - No 'Access-Control-Allow-Origin' header issue with hapijs -
hi have problem facebook app. when start after authentcation gives me error :
xmlhttprequest cannot load http: //localhost:8000/informations. no 'access-control-allow-origin' header present on requested resource. origin 'http: //localhost:8080' therefore not allowed access. :8080/carrandomizer:1
xmlhttprequest cannot load http: //localhost:8000/rand. no 'access-control-allow-origin' header present on requested resource. origin 'http: //localhost:8080' therefore not allowed access.
so understand cors problem, tryed follow official docs http://hapijs.com/api#serverrouteoptions , set on server.js file this:
server.connection({ port: process.env.port, routes: { cors: true } });
and have same error:
xmlhttprequest cannot load https: //www.facebook.com/v2.3/dialog/oauth?client_id=1463042613952341&respo…k&state=uract6cxqf_jzjygs9klwm&scope=public_profile%2cuser_friends%2cemail. no 'access-control-allow-origin' header present on requested resource. origin 'null' therefore not allowed access. angular.js:12330 (anonymous function) @ angular.js:12330(anonymous function) @ app.js:817(anonymous function) @ angular.js:14567a.$get.n.$eval @ angular.js:15846a.$get.n.$digest @ angular.js:15657a.$get.n.$apply @ angular.js:15951l @ angular.js:10364f @ angular.js:10536e @ angular.js:10487 :8080/carrandomizer:1 xmlhttprequest cannot load https: //www.facebook.com/v2.3/dialog/oauth?client_id=1463042613952341&respo…k&state=j-vsbeb6rgvei_cgu-9trm&scope=public_profile%2cuser_friends%2cemail. no 'access-control-allow-origin' header present on requested resource. origin 'null' therefore not allowed access.
finally tryed set hanlder
http: //localhost:8000/rand
the response header nothing changes.
try specifying origin: ['*']
in route configuration:
server.connection({ port: process.env.port, routes: { cors: { origin: ['*'] } } });
it looks hapi not picking connection options.
Comments
Post a Comment