koajs / session

Simple session middleware for koa
MIT License
902 stars 113 forks source link

Add the domain parameter to config #140

Open nicbarker opened 6 years ago

nicbarker commented 6 years ago

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.

traubisoda commented 6 years ago

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! :)

nicbarker commented 6 years ago

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.

geritol commented 6 years ago

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 commented 6 years ago

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

dead-horse commented 6 years ago

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

geritol commented 6 years ago

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

rahulgi commented 6 months ago

This seems to be working fine now and can probably be closed.