问题原文
原帖链接 · IAmJulianAcosta · CC BY-SA 3.0
I have a cookie that I need to be read in Javascript, so I need to remove the httponly part of the cookie from it.
This is the cookie I need to modify:
Set-Cookie: wordpress_c3d46b752402579c18e981091b8c940c=admin%7C1463963639%7CWsIehTVJh4%7C7ee6e8117b6b; expires=Mon, 23-May-2016 12:33:59 GMT; Max-Age=1252800; path=/wp-content/plugins; domain=.example.org; HttpOnly
I just need to strip the HttpOnly string at the end of the cookie
PS: I know that I'm introducing a potential security problem here.
已采纳解答
原帖链接 · IAmJulianAcosta · CC BY-SA 3.0
This is possible using Lua:
nginx.conf:
location /foo {
internal;
#Do normal stuff that you will do in this location
}
location /bar {
content_by_lua_block {
response = ngx.location.capture("/foo")
for cookieName, cookie in pairs(response.header["Set-Cookie"]) do
#Modify cookie as needed
end
}
}
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
