symfony - Ember App Kit + RESTAdapter + PHP - PUT request fails -
I am using amber app kit and amber data to communicate with the server, so far everything works great I have been able to create the model and retrieve data using the REAtadapter
I have implemented the JSON API using Symfony2.
But now when I want to save the edited data on the server and when I call the saved method () on the model, it sends an option request to the server but XMLHttpRequest can not load. Method PUT is not allowed by entry-control-permission-methods
I know that you can not send PUT requests from the browser to another domain and I'm not saying how to do this < / P>
My question is how can I use Amber App Kit and its features and service and front app on the same domain? When I start grunting using Amber App Kit then this port starts from 8000 and my Apache is working on the port which is working on the port 80.
As I can copy + Amber App Kit's generated results, if there is a better solution by using Apache as Apache, I keep on spinning.
Maybe it's not the best way to do this: it worked for me
This solution is for symphony 2, but the same logic will work anywhere.
I just added it to app_dev.fp (or anywhere your app's entry point):
> Header ('Access-Control-Permission-Practices: Received Make, Post, Keep, Options'); Header ('access-control-app-headers: content-type'); Header ('access-control-app-headers: approved, content-type');
Now if you are using Symfony2, you need to add the "methods" parameter to your routes in the routing.yml file:
Routing example routing.yml In:
,
, > user_update: pattern: / user / {id} default: { _controller: yourBundle: User: Update} / html>
Comments
Post a Comment