我已经安装了laravel homestead,它运行正常我能够与后端通信并使用API获得响应。现在我也安装了angularjs它似乎也可以工作,但是什么不起作用是从Angular应用程序作为前端POST或GET到laravel API。我在firefox检查器网络中收到以下错误:
405 Method Not Allowed
request headers
Host: demo.app:8000
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:37.0) Gecko/20100101 Firefox/37.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Origin: http://frontend.app:8000
Access-Control-Request-Method: POST
Access-Control-Request-Headers: content-type
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
Response Header
Cache-Control: no-cache
Connection: keep-alive
Content-Type: text/html; charset=UTF-8
Date: Fri, 01 May 2015 02:28:25 GMT
Server: nginx/1.6.2
Set-Cookie: laravel_session=
Transfer-Encoding: chunked
并在控制台日志中:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://demo.app:8000/myUrl This can be fixed by moving the resource to the same domain or enabling CORS.
我不确定他们为什么不通信我正确地遵循了所有说明并且他们独立工作(Laravel API和Angularjs用于前端)。任何想法和帮助将不胜感激