Reputation: 21
All is in the title, when i look for the cookie in a browser i got :
"_toDoListMaster_key SFMyNTY.g3QAAAABbQAAAAtfY3NyZl90b2tlbmQAA25pbA.ehmC7o9_KRHqClwacE38DX1JHZBmcPu79kJQpvDdBo localhost / Session 109 o"
It's just a key so why that error ?
Sorry for my limited english and thank you for your help !!
Upvotes: 2
Views: 1213
Reputation: 2077
The header value is by default allowed to be 4096 Bytes in size. In your case the lenght of that headers value is supposedly much bigger.
You can configure a different maximum for cowboy like so (max_header_value_length key):
config :your_app, YourAppWeb.Endpoint,
http: [
port: 8080,
compress: true,
protocol_options: [
request_timeout: 5000,
max_header_value_length: 8192
],
transport_options: [
num_acceptors: 150
]
],
url: [host: "example.com", port: 443, path: "/", scheme: "https"],
cache_static_manifest: "priv/static/cache_manifest.json",
root: ".",
server: true,
is_production: true,
version: Mix.Project.config()[:version]
The documentation of cowboy configuration can be found here
Heads up, it is discouraged to increase the maximum cookie value size as it may lead to the browsers truncating the cookie value. In some cases it may still be helpful to increase the cookie values size for example if you are not the one setting the cookies but want to handle the clients with oversized cookies. Nevertheless reach out to the one responsible for the cookies bomb!
Upvotes: 0
Reputation: 8898
How many things have you stuffed in cookies?
Cookies of the same origin and same path share 4KiB space. You got this error because maybe something else already eats up 3.99KiB cookie space.
You should not put too many things in cookies, especially things that may scale. If something is used purely on browsers, then consider putting it in window.localStorage
. If it is used purely on server, then put it in some sort of database (eg MySQL or Redis).
Upvotes: 1