@ httpOnly 옵션?

  • cookie 옵션으로, RFC 에는 명시되어 있지 않지만, 지금은 거의 대부분의 브라우저들이 지원
  • 이 옵션을 설정하면, 서버로 http Request 요청시에만 cookie 를 전송함.
  • document.cookie 같은 스크립트 언어로 브라우저의 cookie 를 호출했을 때 브라우저가 응답을 하지 않음.
  • servlet 3.0 부터 추가됨.

 

 

@ 설정 방법

 1. Tomcat 

  • Tomcat 6.0.19 and Tomcat 5.5.28.부터 지원.
  • conf/context.xml 에 설정.

<?xml version="1.0" encoding="UTF-8"?>

    <Context path="/myWebApplicationPath" useHttpOnly="true">

 

 2. JEUS

  • JEUS 6.0 fix9 부터 지원 (http-only 를 true 설정하지 않아도 default 가 true)
  • WEBMain.xml 이나 jeus-web-dd.xml 에 설정

    <session-config>

        <session-cookie>

            <jsessionid-name>JSESSIONID</jsessionid-name>

            <version>0</version>

            <domain>.tmax.co.kr</domain>

            <path>/</path>

            <max-age>-1</max-age>

            <secure>false</secure>

            <http-only>true</http-only>

        </session-cookie>

    </session-config>

 

 3. JBoss 5.0.1 and JBOSS EAP 5.0.1

  • /server/<myJBossServerInstance>/deploy/jbossweb.sar/context.xml 에 설정

    <Context cookies="true" crossContext="true">

       <SessionCookie secure="true" httpOnly="true" />

 

 4. IBM Websphere 다음 링크 참고 (어드민 콘솔에서 설정)    http://pic.dhe.ibm.com/infocenter/tivihelp/v33r1/topic/com.ibm.mam.inswas.doc/install/t_configuringthehttponlyattribute.html

 

 5. servlet 3.0 지원되는 경우 web.xml 에 설정 가능.

<?xml version="1.0" encoding="UTF-8"?>

<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="http://java.sun.com/xml/ns/javaee " target="_blank">http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">

...

    <session-config>

        <cookie-config>

            <http-only>true</http-only>

        </cookie-config>

    </session-config>

...