CORS on PHP and Google App Engine -
i've been working on app engine past day , stuck on 1 thing.
cors
ive included following top of php files
header('access-control-allow-origin: *'); header('header set access-control-allow-credentials: true'); header('header add access-control-allow-headers "origin, x-requested-with, content-type"'); header('header add access-control-allow-methods "put, get, post, delete, options"');
in app.yaml file have following
application: app version: 1 runtime: php55 api_version: 1 module: default handlers: - url: / script: index.php - url: /ip script: /ip/index.php - url: /user script: /user/index.php - url: /user/auth script: /user/auth/index.php - url: /user/check script: /user/check/index.php - url: /user/dash script: /user/dash/index.php - url: /user/forget script: /user/forget/index.php - url: /user/generate script: /user/generate/index.php - url: /user/link script: /user/link/index.php - url: /user/maps script: /user/maps/index.php - url: /user/profile script: /user/profile/index.php - url: /user/register script: /user/register/index.php - url: /user/reset script: /user/reset/index.php - url: /user/signin script: /user/signin/index.php - url: /user/signout script: /user/signout/index.php - url: /user/status script: /user/status/index.php - url: /user/subscription script: /user/subscription/index.php - url: /user/unlink script: /user/unlink/index.php - url: /user/visible script: /user/visible/index.php - url: /user/alert script: /user/alert/index.php
i use endpoints on domain , first 2 return values, others return along lines of this
xmlhttprequest cannot load http://domaincom/user/status. wildcard '*' cannot used in 'access-control-allow-origin' header when credentials flag true. origin 'http://localhost:9000' therefore not allowed access.
i'm unsure how fix issue seems nested endpoints fail.
header('access-control-allow-origin: http://localhost:9000'); header('access-control-allow-credentials: true'); header('access-control-allow-headers "origin, x-requested-with, content-type"'); header('access-control-allow-methods "put, get, post, delete, options"');
the above fixes issue
Comments
Post a Comment