使用 cookie 重定向
Redirect with cookies
是否可以使用 cookie 重定向到其他域?我试过以下。
def test_redirect
response.headers['Cache-Control'] = 'no-cache, no-store, must-revalidate'
response.headers['Pragma'] = 'no-cache'
response.headers['Expires'] = '0'
request.cookies[:foo] = {value: 'Viktor is here!', domain: '.google.com'}
redirect_to 'http://google.com/'
end
但是没有用。我的 cookie 没有出现。
您不能为其他域设置 cookie。允许这样做会带来巨大的安全漏洞。
是否可以使用 cookie 重定向到其他域?我试过以下。
def test_redirect
response.headers['Cache-Control'] = 'no-cache, no-store, must-revalidate'
response.headers['Pragma'] = 'no-cache'
response.headers['Expires'] = '0'
request.cookies[:foo] = {value: 'Viktor is here!', domain: '.google.com'}
redirect_to 'http://google.com/'
end
但是没有用。我的 cookie 没有出现。
您不能为其他域设置 cookie。允许这样做会带来巨大的安全漏洞。