@iap Packages
    Preparing search index...

    Interface CookieOptions

    Cookie 配置项

    interface CookieOptions {
        domain?: string;
        expires?: number | Date;
        maxAge?: number;
        path?: string;
        sameSite?: "strict" | "lax" | "none";
        secure?: boolean;
    }
    domain?: string

    生效域名,如 '.example.com'

    expires?: number | Date

    过期时间:Date 对象或秒数(从当前时间计算) 与 maxAge 互斥,同时设置时 expires 优先

    maxAge?: number

    最大存活时间(秒) 与 expires 互斥,同时设置时 expires 优先

    path?: string

    Cookie 生效路径,默认 '/'

    sameSite?: "strict" | "lax" | "none"

    跨站策略:

    • 'strict' 仅同站
    • 'lax' 部分跨站(默认行为)
    • 'none' 允许跨站(需配合 secure: true)
    secure?: boolean

    仅在 HTTPS 下传输