ctx.cookies.set(name, value, [options])
Set the value named name in the cookie, and options are optional parameters:
Signed: Do you want to sign
Expires: cookie expiration time
Path: path: cookie, default is/'
Domain: domain: cookie
Secure: false means cookie is sent via HTTP protocol, true means cookie is sent via HTTPS.
HTTPOnly: true means cookie can only be sent through the http protocol.
Note: Koa uses the cookies module of Express, and the options parameter is simply passed directly.
This is koa’s way of setting cookie, and then I can use them in get, but failed in post. There is no cross-domain problem in the local environment, is there?
There is nothing special about the cookie method of express.
I don’t quite understand why
Why is there no cross-domain problem in the local environment? As long as the address: port is different, it is cross-domain.