doujiexin1136 2018-04-06 03:42
浏览 131
已采纳

在响应有效负载中查找HTTP_COOKIE的来源?

The following code correctly identifies a properly formed payload and sends a 200 response.

if($signature == $authKey)
{
    if (isset($_SERVER['HTTP_COOKIE'])) {
        $cookies = explode(';', $_SERVER['HTTP_COOKIE']);
        foreach($cookies as $cookie) {
            $parts = explode('=', $cookie);
            $name = trim($parts[0]);
            setcookie($name, '', time()-1000);
            setcookie($name, '', time()-1000, '/');
        }
    }
    http_response_code(200);
    XeroWebHookHandler::handlePayload($rawPayload);
}

The endpoint however, won't accept a HTTP response containing a cookie.

The above code is giving me the following response Response contained a cookie.

My service is hosted on an AWS EC2 instance running a standard Ubuntu server hosting apache.

What methods can I use to correctly identify what might be setting a HTTP_COOKIE variable. Alternatively, am I clearing it correctly?

  • 写回答

1条回答 默认 最新

  • doujianjian2060 2018-04-06 05:50
    关注

    I found it. The answer helped in my specific case, but I will share it in case anyone else has the same issue.

    Session cookies are the issue.

    session_destroy();
    setcookie("PHPSESSID", "", time()-3600, "/");
    

    I found that session_destroy() alone left some crumbs.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 用lstm来预测股票价格
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥170 如图所示配置eNSP
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改
  • ¥20 wireshark抓不到vlan
  • ¥20 关于#stm32#的问题:需要指导自动酸碱滴定仪的原理图程序代码及仿真
  • ¥20 设计一款异域新娘的视频相亲软件需要哪些技术支持
  • ¥15 stata安慰剂检验作图但是真实值不出现在图上