Viktor
Viktor

Reputation: 4346

Redirect with cookies

Is it possible to redirect to other domain with cookies? I tried followong.

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

But it didn't work. My cookie doesn't appear.

enter image description here

Upvotes: 0

Views: 1385

Answers (1)

Roman Kiselenko
Roman Kiselenko

Reputation: 44370

You cannot set cookies for another domain. Allowing this would present an enormous security flaw.

Upvotes: 2

Related Questions