FAQ

Q: How do I set cookies from Jets?

You can set cookies with the set_header method in the controller. Here is an example

  def index
    set_header("Set-Cookie", "foo=bar")
    response.set_header("Custom", "MyHeader") # also works to set headers
    response.headers["Custom2"] = "MyHeader" # also works to set headers
  end

Pro tip: Use the <- and -> arrow keys to move back and forward.

Edit this page

See a typo or an error? You can improve this page. This website is available on GitHub and contributions are encouraged and welcomed. We love pull requests from you!