[英]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?什么可能导致这种情况?
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.