douye7033 2017-11-13 11:12
浏览 91
已采纳

远程服务器不发送响应头,本地服务器

I have a php file that should be sending response headers, but it isn't. Here is the networking tab of both the local server and the remote server. As you can see, the local server is sending many different headers, but the remote server isn't sending any.

enter image description hereenter image description here

I sent all the response headers using php header(), but since this works perfectly on the local server, im guessing it's a server configuration issue? If anyone has had this issue before, please share an answer - i've been pulling my hair out over this for 3 days now -_-

EDIT thought the php code might help:

<?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");

theres no whitespace before this php code. Also if there was an issue with this code, surely it wouldnt work on my local server?

Thanks, Josh

  • 写回答

1条回答 默认 最新

  • dr5779 2017-11-13 11:29
    关注

    Same problem is here;

    Try to use ob_start(); just after <?php and use ob_end_flush(); at the end of your document.
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 多址通信方式的抗噪声性能和系统容量对比
  • ¥15 winform的chart曲线生成时有凸起
  • ¥15 msix packaging tool打包问题
  • ¥15 finalshell节点的搭建代码和那个端口代码教程
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 海浪数据 南海地区海况数据,波浪数据
  • ¥20 软件测试决策法疑问求解答