Hairi
Hairi

Reputation: 3715

How do I set a cookie HttpOnly flag to false in Rails (not HttpOnly cookie)

Rails version 5.1.5

Inside the controller action I set the cookie this way:

  cookies[:imNotARobot] =  {
    value: "true",
    max_age:  24*60*60,
    http_only: false,
    secure: Rails.env == "development" ? false : true
  }

Everything works as a charm : Set cookie header is sent, the cookie is being set by the browser, the expiration(max_age) works correctly, the secure flag works correctly. The only thing I cant get work is to unset/uncheck/remove the HttpOnly flag. What am I doing wrong or how to set a cookie without HttpOnly flag?

Upvotes: 0

Views: 1151

Answers (1)

Eyeslandic
Eyeslandic

Reputation: 14890

It is httponly, not http_only

https://api.rubyonrails.org/v5.1.7/classes/ActionDispatch/Cookies.html

Upvotes: 1

Related Questions