T
T
templton19822019-06-04 20:02:14
PHP
templton1982, 2019-06-04 20:02:14

Why aren't cors headers being substituted?

I send headers to the sides of the backend:

header("Access-Control-Allow-Origin: validate.ru");
header('Access-Control-Allow-Credentials: true');
header('Access-Control-Max-Age: 86400');


From the front I make an ajax request through jquery. And here's the question. Why, if I add such a line to the request parameters, then on the network tab, I will see that the server has inserted cors headers, and without this line, the cors headers are going somewhere. There is another clarification. The front is located on localhost. But the host configured. That is, requests go with the name origin=my_domain.ru
dataType: 'jsonp',

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Gribanov, 2019-06-05
@gribanov2la

Quote from api.jquery.com/jquery.ajax
Those. when requesting dataType:'jsonp'CORS is not used. Hence the problem is not in jsonp, but in incorrect CORS setup. Unfortunately, the example that you gave does not give a complete picture of what is configured wrong.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question