Skip to content
Download

SameSite

mach::http::SameSite

Specifies the cross-site behavior of an HTTP cookie.

Primary header:

#include <mach/http/Cookie.hpp>

Convenience header:

#include <mach/mach.hpp>
enum class SameSite {
Strict,
Lax,
None
};
Name Description
Strict Sends the cookie only with same-site requests.
Lax Sends the cookie with same-site requests and top-level cross-site navigation.
None Sends the cookie with both same-site and cross-site requests. Requires Secure.
  • SameSite::Lax is the default value used by mach::http::Cookie.
  • Most applications should use Lax or Strict to reduce the risk of cross-site request forgery (CSRF).
  • SameSite::None is intended for cookies that must be sent with cross-site requests and should be used together with secure = true.
Name Description
Cookie Represents an HTTP cookie and exposes the sameSite property.