REST API recommendation / crossdomain

I am developing a Backbone application that relies heavily on the REST API using ajax / fetch calls.

All my business logic is written in PHP classes using MySQL. Right now I'm using FRAPI as an API, which works very well for me.

In my development environment, I have two virtual hosts:

  • HTML / JS static client application -> localhost
  • FRAPI API in PHP -> api.local

The problem is that my clients' requests are crossdomain (IE and such a browser do not work).

What can I do to prevent my vhost static client (without PHP proxy) and not use JSONP? What RESTful API is commonly used for Backbone?

+6
source share
1 answer

see here on how you can achieve cross domain calls ...

backbone.js and cross-domain scripts

I'm afraid, however, you will need option 2 provided in the above URL ...

0
source

Source: https://habr.com/ru/post/902403/


All Articles