C
C
Christopher Carter2021-04-18 14:27:52
Yii
Christopher Carter, 2021-04-18 14:27:52

How to check that the request was sent with fetch in Yii2?

There are functions like isAjax, but there is no function that would check that the request was sent with fetch. How to check it on the server side - in PHP or Yii2 capabilities? It is necessary to exclude (not completely, but to make an obstacle) the possibility of data parsing.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya, 2021-04-19
@rpsv

Apparently by the sec-fetch headers:

screen
607d0e4edd8a8640692171.png

-
Only how it will save from curl requests is a question, of course, especially since fetch, that ajax can only be done from the same domain, if of course you have a restriction on Access-Control-Allow-Origin.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question