Answer the question
In order to leave comments, you need to log in
How to get rid of CORS preflight?
API and client are on different hosts - api.domain.local and domain.local.
In each request to the API, I must pass the token. I create a custom Token header for this.
All requests with this header are executed with a preflight (OPTIONS request), which reduces performance.
Added the following to .htaccess. line:
Header add Access-Control-Allow-Origin "*"
Header add Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS"
Header add Access-Control-Allow-Headers "Token" #вот
Answer the question
In order to leave comments, you need to log in
I create a custom Token header for this.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question