Last active
May 20, 2020 13:10
-
-
Save danielfone/c8ab593c326a8052651c to your computer and use it in GitHub Desktop.
Monkey-patch to prevent Devise from causing CookieOverflow errors
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/initializers/devise_safe_store_location.rb | |
module SafeStoreLocation | |
MAX_LOCATION_SIZE = ActionDispatch::Cookies::MAX_COOKIE_SIZE / 2 | |
def store_location_for(resource_or_scope, location) | |
super unless location && location.size > MAX_LOCATION_SIZE | |
end | |
end | |
Devise::FailureApp.include SafeStoreLocation |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Further details and rationale: http://daniel.fone.net.nz/blog/2014/11/28/actiondispatch-cookies-cookieoverflow-via-devise-s-user_return_to/