#3846·axum

Replace the `cookie` crate for ease of use

Author: DarckfastCreated Jul 25, 2026Updated Jul 26, 2026
  • I have looked for existing issues (including closed) about this

Feature Request

Motivation

I have looked through other issues/PRs related to this, and im still not fully aware of the reasoning behind this implementation, but i decided to bring this proposal as it might help more people

At the moment the cookie crate (https://github.com/rwf2/cookie-rs), used on axum-extra to create cookies, has a dependency with the time crate to set the cookie's max_age and expires, which creates the issue that you can't just set a cookie's expires or max_age without having to add an extra crate to your project (related https://github.com/tokio-rs/axum/issues/1881 https://github.com/tokio-rs/axum/pull/918 https://github.com/tokio-rs/axum/pull/2217)

Besides this being a overkill considering that the std::time already provides the necessary to do the same, and it's far more convinient to use, there has been issues related to the time crate before https://github.com/rwf2/cookie-rs/issues/255

People have tried to replaced the time crate on cookie for a while now, but no PR went through so far

Proposal

Replace cookie with cookie-rs https://github.com/magwoo/cookie-rs (or internalize it)

The cookie-rs crate has a pretty similar contract as cookie, the main trade-off (and breaking change) would be the loss of the signed cookie jar, but the basic features .max_age() and .expires() would be far more convenient to use out of the box, since they use the std::time by default

Alternatives

An alternative would be to remove the time dependency in the cookie crate, but there have been multiple attempts, and none of which went forward

https://github.com/rwf2/cookie-rs/issues/109 https://github.com/rwf2/cookie-rs/pull/217 https://github.com/rwf2/cookie-rs/pull/213