LoginSignup
3
2

More than 5 years have passed since last update.

WildFlyでcookieにsecure属性をつける

Last updated at Posted at 2014-04-12

概要

WildFlyをロードバランサの配下において、SSLをロードバランサで解除することを想定。
この場合、非SSLでWildFlyにリクエストが来てもSecure Cookieを発行したい。
WildFlyで常にSecure Cookieを返すようにする。

standalone.xml
            <servlet-container name="default" default-buffer-cache="default" stack-trace-on-error="local-only">
                <jsp-config/>
                <session-cookie http-only="true" secure="true"/>
            </servlet-container>

secureのついでにhttpOnly属性もつけておく。

出力されるCookieはこんな感じ。

Set-Cookie: JSESSIONID=8hcdNBxD85gw57wPoZrfUorq.host1; path=/exampledbtest; secure; HttpOnly 

デフォルトでJSESSIONIDの末尾にホスト名が付いているので、Sticky sessionとして使えそう。GlassFishの時はi1などホスト名ではないものをつけていたが、別の値に変更する方法はないものか。。。

3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2