Develop Angular SPA on localhost and query the remote staging API

37 views Asked by At

I have troubles setting up my development environment.

I am attempting to develop an Angular SPA which should, in the end, communicate with a Laravel backend that is hosted under the same top domain name.

For ease of developement, I am hosting my API on a remote location, let's say :

my-api.myhost.com

Now, when I am working on my Angular SPA, I am working on localhost. Meaning, I have to do queries on my-api.myhost.com

Obviously, this wouldn't work since I must do POST request which are blocked if the X-XSRF-TOKEN is not present in the Headers of the request.

The problems comes from the fact that I am retrieving the cookies but unable to set them in the header of my request since the domain do not match (.myhost.com vs localhost)

How can I conveniently develop my app on localhost and hit the remote backend server ?

0

There are 0 answers