CORS在一页上工作,但不在另一页上工作,两个页面使用相同的代码

时间:2019-12-12 11:15:10

标签: php cors http-headers response-headers


我使用Cloudflare在SSL上托管了fllmatrix.com网站,并在Infinityfree上托管了SSL。
我在网站上有两页:
1
2
它们都有相同的代码:

<?php
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Headers: X-Requested-With");
$url = $_GET['url'];
$text = file_get_contents($url);
echo nl2br($text);?>

与“ index.php”同名。
现在在第一页上,为任何来源启用了CORS,
但在第二页中,它却无法正常工作。
“不起作用”是指浏览器不允许我从另一个域访问它,并显示Access to font at 'https://fllmatrix.com/fonts/atariFull' from origin 'http://localhost' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.错误。

发生这种情况的任何原因?

0 个答案:

没有答案