Access-Conrol-Allow-Origin on multiple files for cross-domain

落花浮王杯 提交于 2019-12-13 03:55:29

问题


I've encountered that this does not work on multiple files when working with cross-domain. Anyone have any reason or am I doing something wrong? I was able to have it work on one PHP file (mydomain.com/file1.php) that I'm accessing from another domain (hisdomain.com). When I tried to access another PHP (mydomain.com/file2.php) from the same domain (hisdomain.com), it won't let me access my scripts in file2.php, because I already have

header("Access-Control-Allow-Origin: *");

in file1.php. Is this coincidence? Should this not be the problem?

However, these files is in an actual hosting site. (e.g. mydomain.com). When I tried working in localhost (http://127.0.0.1/file1.php and http://127.0.0.1/file2.php) with hisdomain.com, file1.php and file2.php was working correctly with both having

header("Access-Control-Allow-Origin: *");

来源:https://stackoverflow.com/questions/11717551/access-conrol-allow-origin-on-multiple-files-for-cross-domain

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!