Czy ktoś wie jak naprawić taki błąd?
W kodzie PHP mam:
header('Access-Control-Allow-Credentials: true');
ale w konsoli przeglądarki dostaję następujący błąd:
The value of the 'Access-Control-Allow-Credentials' header in the response is 'true, true' which must be 'true' when the request's credentials mode is 'include'.Próbowałem na różne sposoby :/
Pełen kod to:
if(isset($_SERVER['HTTP_ORIGIN'])) {
header('Access-Control-Allow-Origin: '.trim($_SERVER['HTTP_ORIGIN'])); } else {
header('Access-Control-Allow-Origin: '.trim($tmp['scheme'].'://'.$tmp['host'])); }
header('Access-Control-Allow-Methods: GET, POST, PATCH, PUT, DELETE, OPTIONS'); header('Access-Control-Allow-Headers: X-Requested-With, Origin, Content-Type, X-Auth-Token'); header('Access-Control-Allow-Credentials: true');
Jest to zrobione w taki sposób, bo chcę obsługiwać zapytania z dowolnej domeny, a nie mogę edytować .htaccess (a w zasadzie mogę, ale nic to nie daje).