httpレスポンスでSet-Cookieに値が入っているのですが、
開発者ツールでcookieを調べてもcookieに何も登録されていません。
Set-Cookieを値があればブラウザがCookieの保存を自動でしてくれるという認識だったのですが、
他にも設定が必要だったのでしょうか。
【環境】
OS:windows10
WEBサーバー:Apache2.4.43
APサーバー:tomcat8.5.53
フレームワーク:spring
サーバー側
java
1 @RequestMapping(value = "/testInit", method = RequestMethod.POST) 2 private String doInit(HttpServletResponse response, @ModelAttribute testModel test) { 3 Cookie sampleCookie = new Cookie("sample1", "aaaaa"); 4 sampleCookie.setPath("/"); 5 response.addCookie(sampleCookie); 6 7 return "redirect:http://localhost/home.html"; 8 };
クライアントのレスポンス
Connection: close
Content-Language: ja
Content-Length: 0
Date: Mon, 11 May 2020 09:10:42 GMT
Location: http://localhost/home.html
Server: Apache/2.4.43 (Win64) OpenSSL/1.1.1f
Set-Cookie: sample1=aaaaa; Path=/
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。