0
最後我決定張貼...我覺得白癡,很多信息,我也沒有找到答案,的Symfony2 + AngularJS + CORS
很好,問題是在CORS,我試着做這angularJS:
var request = $http({
method: "POST",
url: url,
data: data
});
URL是用symfony的做JsonResponse(),沒有一個服務器特殊,與郵差嘗試它,它是所有罰款(所以..服務器是好?),但是當我嘗試與其他網絡我在控制檯看到:
XMLHttpRequest cannot load http://server/login. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:63342' is therefore not allowed access. The response had HTTP status code 405.
其實在symfony中我有NelmioBundle與配置:
nelmio_cors:
defaults:
allow_credentials: true
allow_origin: ['*']
allow_headers: ['*']
allow_methods: ['POST', 'PUT', 'GET', 'DELETE','OPTIONS']
max_age: 3600
paths:
'^/':
allow_origin: ['*']
allow_headers: ['*']
allow_methods: ['POST', 'PUT', 'GET', 'DELETE','OPTIONS']
max_age: 3600
我使用LEMP瞭解更多信息,
感謝提前和我verybad英語對不起!
此鏈接您還沒有定義'在默認或路徑host'。 – hcoat 2014-10-29 01:48:45