开发者

how do I test httpOnly cookie flag

开发者 https://www.devze.com 2023-01-27 11:13 出处:网络
I have set the following property in websphere for the js开发者_开发问答ession cookie com.ibm.ws.webcontainer.HTTPOnlyCookies.

I have set the following property in websphere for the js开发者_开发问答ession cookie com.ibm.ws.webcontainer.HTTPOnlyCookies.

Any idea how best to test this using JavaScript in Firefox or IE?


It's a pain in IE. I have IE9 so your screens may be different.

Press F12, go to the network tab, and then press Start Capturing. Back in IE then open the page you want to view. Back in the F12 window you show see all the individual HTTP requests, select the one that's the page or asset you're checking the cookies on and double click on it. You should then be able to see all the response headers and cookies on their relevant tabs.


Edit:

A HttpOnly Cookie would look something like this:

Set-Cookie: SessionId=z5ymkk45aworjo2l31tlhqqv; path=/; HttpOnly

The cookie may not be sent with every response, so you may need to clear all of your cookies and then try again to make sure one is sent with the request you're monitoring.


Firebug - click on the Cookies tab


firecookie for firefox gives me the answer.


The easiest way to do it on Chrome or Firfox is as below:

  • Open the page for instance somedomain.com
  • Open dev tools by right clicking on page and then clicking on Inspect or Inspect Element
  • Click on Network tab
  • Click on any of the actual request and go to Headers section
  • Now look for set-cookie in response headers

Here is the screenshot for details

how do I test httpOnly cookie flag


add the following lines to your app String

sessionid = request.getSession().getId();
response.setHeader("SET-COOKIE", "JSESSIONID=" + sessionid + "; secure; HttpOnly");
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号