为什么我不能设置 cookie 和重定向? [英] Why can't I set a cookie and redirect?

查看:35
本文介绍了为什么我不能设置 cookie 和重定向?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在设置 cookie 和执行 302 重定向时遇到问题
在 chrome 中没有设置 cookie(我没有测试过 safari),在其他浏览器中我遇到了同样的问题,直到我将 Path=/ 添加到 cookie 现在它可以工作了.

I'm having a problem setting a cookie and doing a 302 redirect
In chrome the cookie is not being set (I haven't tested safari), in other browsers I was having the same problem until I added Path=/ to the cookie an now it works.

这是标题的样子;状态为 302 Found

This is how the header looks; the status is 302 Found

Content-Type    text/html; charset=iso-8859-1
Expires Thu, 01 Jan 1970 00:00:00 GMT
Set-Cookie  alasca-flash=error-Message<Required<error-Name<Required<error-Sex<Required<error-Age<Required<;Path=/
Location    /messages/sdf
Content-Length  0
Server  Jetty(6.1.x)

知道为什么没有设置 cookie 吗?或者有什么解决办法?

Any idea on why the cookie is not set? Or any workaround?

推荐答案

看到这个问题:Safari 不设置 Cookie 但 IE/FF确实

它提到了WebKit 中的这个错误报告(由于 AFC)

It mentions this bug report in WebKit (due to AFC)

这篇关于为什么我不能设置 cookie 和重定向?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆