简体   繁体   English

ActionDispatch::Cookies::CookieOverflow 但 cookie 很小

[英]ActionDispatch::Cookies::CookieOverflow but the cookie is small

I recently started receiving a ActionDispatch::Cookies::CookieOverflow from a simple form upload.我最近开始从一个简单的表单上传接收ActionDispatch::Cookies::CookieOverflow Looking at the POST request, the Content-Length is 25000+, but the cookie is only 520 characters and contains only the session cookie.查看POST请求,Content-Length是25000+,但是cookie只有520个字符,只包含会话cookie。 ActionDispatch::Cookies::MAX_COOKIE_SIZE is 4096. ActionDispatch::Cookies::MAX_COOKIE_SIZE 是 4096。

This is the form in question.这是有问题的表格。 It's an ActiveAdmin sidebar.这是一个 ActiveAdmin 侧边栏。

<link rel="stylesheet" href="http://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<%= form_tag "/import/from_csv", method: :post, multipart: true do %>
  Upload a CSV file.
  <%= label_tag(:file, 'CSV file:') %>
  <%= file_field_tag(:file) %>

  <%= label_tag(:reason, "Default Reason:") %>
  <%= select_tag(:reason,
        options_for_select(Rails.configuration.x.reasons, "unknown")
      )
  %>

  <%= label_tag(:source, "Default Source:") %>
  <%= text_field_tag(:source, 'csv') %>

  <%= submit_tag("Import",  id: "import") %>
<% end %>

We're using the default session store with the JSON cookies serializer.我们将默认会话存储与 JSON cookie 序列化程序一起使用。 We're not doing anything special with cookies.我们对 cookie 没有做任何特别的事情。 I tried clearing the cookie, same problem.我尝试清除cookie,同样的问题。

What could be causing this?什么可能导致这种情况?

  • Rails 6.1.3.2导轨 6.1.3.2
  • ActiveAdmin 2.9.0活动管理 2.9.0
  • Ruby 2.7.2红宝石 2.7.2
  • Devise 4.7.3设计 4.7.3

Looking at the cookie value in a debugger, what's happening is each of 50 flashes is being put into the session cookie.查看调试器中的 cookie 值,发生的情况是 50 次闪存中的每一次都被放入会话 cookie。 This bloats out the session value to just under 4k.这将会话值膨胀到略低于 4k。 Encryption puts it over the line.加密将它放在线上。

I'll switch to session cookies.我将切换到会话 cookie。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ActionDispatch :: Cookies :: CookieOverflow - ActionDispatch::Cookies::CookieOverflow 如果ActionDispatch :: Cookies :: CookieOverflow错误,Rails会记录cookie信息 - Rails log cookie information if ActionDispatch::Cookies::CookieOverflow error 如何在heroku上修复ActionDispatch :: Cookies :: CookieOverflow错误? - How to fix ActionDispatch::Cookies::CookieOverflow error on heroku? 使用Facebook omniouth的ActionDispatch :: Cookies :: CookieOverflow - ActionDispatch::Cookies::CookieOverflow using facebook omniouth 如何从ActionDispatch :: Cookie :: CookieOverflow中抢救? - How to rescue_from ActionDispatch::Cookie::CookieOverflow? rails:如何在会话中保存大数组? (ActionDispatch :: Cookies :: CookieOverflow) - rails: how to save a big array in session? (ActionDispatch::Cookies::CookieOverflow) 使用 devise 时如何修复「ActionDispatch::Cookies::CookieOverflow」 - How to fix 「ActionDispatch::Cookies::CookieOverflow」 when using devise rails4升级后,黄瓜测试因ActionDispatch :: Cookies :: CookieOverflow而失败 - cucumber tests Fail with ActionDispatch::Cookies::CookieOverflow after rails4 upgrade 使用55行的Roo导入csv会导致ActionDispatch :: Cookies :: CookieOverflow - Importing a csv with Roo of 55 rows is causing an ActionDispatch::Cookies::CookieOverflow actiondispatch cookieoverflow 发布请求 - actiondispatch cookieoverflow post request
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM