如果自动加载,则阻止 codeigniter 会话库发送 set-cookie 标头参数

发布于 2024-11-19 09:00:24 字数 296 浏览 5 评论 0原文

我有一个基于 codeigniter 的网站,有时我有通过 AJAX 调用并返回 JSON 值的控制器。问题是因为我已经自动加载了会话库,所以从 codeigniter 作为响应发送的任何内容都

Set-Cookie  ci_csrf_token=65d0857a89345g5sg5695e71fa687b14c; expires=Sat, 09-Jul-2011 17:00:29 GMT; path=/

设置了标头参数。这似乎是不必要的带宽开销,有什么方法可以阻止 codeigniter 发送此标头吗?

I have a codeigniter based website and occasionally I have controllers that are called via AJAX and return JSON values. The problem is since I've already autoloaded the session library anything that's sent as a response from codeigniter has the

Set-Cookie  ci_csrf_token=65d0857a89345g5sg5695e71fa687b14c; expires=Sat, 09-Jul-2011 17:00:29 GMT; path=/

header parameter set. This seems like unneccessary bandwidth overhead, is there any way to prevent codeigniter from sending this header?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

故事与诗 2024-11-26 09:00:24

并非不修改 Session 类:它不会在发布的接口中公开对该标头的控制。

此外,该 cookie 不是由 Session 类生成的,而是由 Security 类生成的。您必须禁用 CSRF 保护,不幸的是,您无法在每个请求行为上使用已发布的接口来执行此操作。

Not without modifying the Session class: it does not expose control over that header in the published interface.

In addition, that cookie is not generated by the Session class, but by the Security class. You will have to disable CSRF protection, which is unfortunately not something you can do using the published interface on a per-request behavior.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文