如何测试 httpOnly cookie 标志
我在 websphere 中为 jsession cookie 设置了以下属性 com.ibm.ws.webcontainer.HTTPOnlyCookies
。
知道如何在 Firefox 或 IE 中使用 JavaScript 进行最佳测试吗?
I have set the following property in websphere for the jsession cookiecom.ibm.ws.webcontainer.HTTPOnlyCookies
.
Any idea how best to test this using JavaScript in Firefox or IE?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
在 IE 中这是一个痛苦。我有 IE9,所以你的屏幕可能会有所不同。
按 F12,转到网络选项卡,然后按开始捕获。返回 IE,然后打开您要查看的页面。返回 F12 窗口,您可以看到所有单独的 HTTP 请求,选择您正在检查 cookie 的页面或资产,然后双击它。然后,您应该能够在相关选项卡上看到所有响应标头和 cookie。
编辑:
HttpOnly Cookie 看起来像这样:
Set-Cookie: SessionId=z5ymkk45aworjo2l31tlhqqv;路径=/; HttpOnly
Cookie 可能不会随每个响应一起发送,因此您可能需要清除所有 Cookie,然后重试以确保与您正在监控的请求一起发送 Cookie。
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 - 单击 Cookie 选项卡
Firebug - click on the Cookies tab
firecookie for firefox 给了我答案。
firecookie for firefox gives me the answer.
在 Chrome 或 Firefox 上执行此操作的最简单方法如下:
somedomain.com
打开
或dev
工具>InspectInspect Element
Network
选项卡Headers
部分response headers
中的 code>set-cookie下面是详细截图
The easiest way to do it on Chrome or Firefox is as below:
somedomain.com
dev
tools by right clicking on page and then clicking onInspect
orInspect Element
Network
tabHeaders
sectionset-cookie
inresponse headers
Here is the screenshot for details
将以下行添加到您的应用程序中
细绳
add the following lines to your app
String