【发布时间】:2022-04-23 19:37:18
【问题描述】:
我将 cookie 设置为安全的,但它作为 localhost 工作。但是在 hosts 文件中设置了域名,chrome 没有将 cookie 发送到服务器导致请求失败。
我在 localhost 上运行我的服务器并设置了以下 cookie,cookie 正在通过 chrome 发送到我的服务器。
cookie := http.Cookie{Name: "XSRF-TOKEN", Value: csrf.Token(r), Expires: expiration, Path: "/", HttpOnly: false, Secure: true}
我在我的主机文件中设置了以下内容,并尝试从 chrome x.test.in 中打开 cookie 未通过。 chrome 报告为 set-cookie was blocked because it has the secure attribute but was not received 以下代码在 golang 中并使用 gorilla mux
127.0.0.1 x.test.in
【问题讨论】:
标签: cookies session-cookies gorilla httpcookie