SameSite
mach::http::SameSite
Description
Section titled “Description”Specifies the cross-site behavior of an HTTP cookie.
Headers
Section titled “Headers”Primary header:
#include <mach/http/Cookie.hpp>Convenience header:
#include <mach/mach.hpp>Syntax
Section titled “Syntax”enum class SameSite { Strict, Lax, None};Enumerators
Section titled “Enumerators”| 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. |
Remarks
Section titled “Remarks”- 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.
See Also
Section titled “See Also”| Name | Description |
|---|---|
Cookie |
Represents an HTTP cookie and exposes the sameSite property. |