简体   繁体   中英

How do i disable HttpOnly cookies in Vaadin?

I have set the cookie in Vaadin and try to get it from another application which was running on the different server but I was not able to get that cookie what i have set in Vaadin?

We need to disable httpOnly cookie.

Can anyone help me "How to solve this issue?"

The cookies set in header Set-Cookie . To get it you can use the following code:

URLConnection urlConnection = new URL("url-of-your-web-app-here").openConnection();
List<String> cookiesList = urlConnection.getHeaderFields().get("Set-Cookie");

You can delete flag manually, by deleting HttpOnly :

response.setHeader( "Set-Cookie", "name=value; HttpOnly");

If you're working in a Servlet 3.0 or newer environment, configure your web.xml as following:

<session-config>
   <cookie-config>
      <http-only>false</http-only>
   </cookie-config>
</session-config>

Note. The HttpOnly flag is an additional flag that is used to prevent an XSS (Cross-Site Scripting) exploit from gaining access to the session cookie.

See Also:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM