
APIサーバー:ec2 -> spring boot
webサーバ :nginx
front : s3 -> react
spring boot でAPIをつくってnginxをかましてreactで表示しようとしたのですが、起動しログインした時に時に以下のようなエラーが出ました。
Invalid cookie header: "Set-Cookie: has_recent_activity=1; path=/; expires=Sat, 18 May 2019 20:58:25 -0000". Invalid 'expires' attribute: Sat, 18 May 2019 20:58:25 -0000
多分ここに該当するであろう箇所を載せておきます。
httpSession.setAttribute(ACCESS_KEY, accessToken); httpSession.setAttribute(UUID_TOKEN, uuid); Cookie cookie = new Cookie("token", uuid); cookie.setMaxAge(deadLine); cookie.setPath("/"); response.addCookie(cookie);
nginxではデフォルト設定に以下を足しました。
location / { add_header Access-Control-Allow-Origin *; add_header Access-Control-Allow-Methods *; add_header Access-Control-Allow-Headers "Origin, Authorization, Accept"; add_header Access-Control-Allow-Credentials true; proxy_pass http://localhost:8080; }
このエラーが原因かどうかわからないのですが、ログインしてもcookie内にフロントではtokenが返ってこず、APIの方ではtokenが入っていました。。。
ここについても謎なので、ご助力お願いいたします。


回答2件
あなたの回答
tips
プレビュー