Answer the question
In order to leave comments, you need to log in
How to cross request in axios?
The api runs at localhost:8000 front on localhost:3000. For queries I use axios.
Gives the following error:
XMLHttpRequest cannot load http://localhost:8000/api/customers. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access.
Answer the question
In order to leave comments, you need to log in
You need to write origin (' Access-Control-Allow-Origin' ) in the header of the server response. These are the addresses of hosts to which external requests are allowed.
For example Node or php .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question