session icon indicating copy to clipboard operation
session copied to clipboard

Add the domain parameter to config

Open nicbarker opened this issue 7 years ago • 7 comments

Hi, It would be very convenient for me if koa-session supported the domain directive in it's config. I'm happy to implement and PR if neccessary.

nicbarker avatar Sep 08 '18 00:09 nicbarker

Hi, It would be very convenient for me if koa-session supported the domain directive in it's config. I'm happy to implement and PR if neccessary.

Hi,

I had to use the domain directive too, so I dug up the code, and since all config params get passed down to "lower layers", I tried to add a domain key to the config object, and it worked! :)

traubisoda avatar Sep 16 '18 17:09 traubisoda

Hi,

I had to use the domain directive too, so I dug up the code, and since all config params get passed down to "lower layers", I tried to add a domain key to the config object, and it worked! :)

Huh, that's interesting. I couldn't get it to work for me, although other parameters that are listed in the readme seemed to work (signed, httpOnly etc). Maybe I had something else wrong in my configuration.

nicbarker avatar Sep 17 '18 00:09 nicbarker

see https://github.com/koajs/session#options

All other options are passed to ctx.cookies.get() and ctx.cookies.set() allowing you to control security, domain, path, and signing among other settings.

geritol avatar Sep 17 '18 18:09 geritol

the problem is, for typescript users, that interface opts does not allow to add other options.

geritol avatar Sep 17 '18 18:09 geritol

koa-session didn't provide typescript definition, maybe you can create a pull request to the tsd which you are using?

dead-horse avatar Sep 19 '18 03:09 dead-horse

Yes, forgot to mention that this is an issue with @types/koa-session and not with this library.

geritol avatar Sep 19 '18 09:09 geritol