我正在尝试从位于http://localhost:8000
的AngularJS应用程序中调用http://localhost
的Laravel中构建的API。我收到一个错误说:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:8000/auth. This can be fixed by moving the resource to the same domain or enabling CORS.
我通过POSTMAN在http://localhost:8000
发送了一个OPTIONS请求,这是响应:
Access-Control-Allow-Credentials → true
Access-Control-Allow-Headers → X-Requested-With, Content-Type, X-Auth-Token, Origin, Authorization
Access-Control-Allow-Methods → POST, GET, OPTIONS, PUT, DELETE
Access-Control-Allow-Origin → *, chrome-extension://fhbjgbiflinjbdggehcddcbncdddomop
Cache-Control → no-cache
Connection → close
Content-Type → text/html; charset=UTF-8
Date → Mon, 29 Dec 2014 06:33:26 GMT
Host → localhost:8000
Vary → Origin
X-Powered-By → PHP/5.5.9-1ubuntu4.5
从我所看到的,所有来源的所有方法都是允许的。我不明白为什么不能胜任这项工作。我错过了什么?