远程服务器未发送响应 headers,本地服务器发送响应

Remote server not sending response headers, local server does

我有一个 php 文件应该发送响应 header,但它不是。这是本地服务器和远程服务器的网络选项卡。如您所见,本地服务器发送了许多不同的 header,但远程服务器没有发送任何内容。

我使用 php header() 发送了所有响应 header,但由于这在本地服务器上运行良好,我猜这是服务器配置问题?如果有人以前遇到过这个问题,请分享一个答案 - 我已经为此烦恼了 3 天 -_-

编辑认为 php 代码可能有帮助:

<?php 
error_reporting(E_ALL);
//disable browser caching !!IMPORTANT
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header('Access-Control-Allow-Origin: *');
header("Access-Control-Allow-Methods: POST, GET"); 
header("Access-Control-Allow-Headers: Random");
header("Access-Control-Expose-Headers: Random");
header("Access-Control-Request-Headers: Random");

此 php 代码之前没有空格。另外,如果此代码存在问题,它肯定无法在我的本地服务器上运行吗?

谢谢, 乔什

同样的问题是here

Try to use ob_start(); just after <?php and use ob_end_flush(); at the end of your document.