Skip to content
This repository was archived by the owner on Jun 24, 2025. It is now read-only.

feat: allow setting custom cookiePath#1155

Merged
eliandoran merged 4 commits intodevelopfrom
feat_custom-cookie-path
Feb 10, 2025
Merged

feat: allow setting custom cookiePath#1155
eliandoran merged 4 commits intodevelopfrom
feat_custom-cookie-path

Conversation

@pano9000
Copy link
Copy Markdown
Contributor

@pano9000 pano9000 commented Feb 10, 2025

Hi,

this PR will allow users to set a custom cookiePath, if they require it (see TriliumNext/Trilium#5473 and the comment in the config-sample.ini for further info on why this might be needed).

I've added a new "Cookies" section, because goal is to also allow e.g. the user to set a custom cookie expiration time, which will be a separate PR, but will go into the same config section.

closes TriliumNext/Trilium#5473

(still in draft, as I need to do a tiny test with the CSRF cookie as well, and requests to the API as well)

edit: There also seems to be an issue with completely new instances, where there is no existing cookie set yet – it currently crashes, because it seems the req.session prop is undefined, when setting the path to anything other than "" or "/"
edit2: ignore the above edit, that was partially a stupid mistake on end running my local dev instance :-)

trustedReverseProxy=false


[Cookies]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would make more sense to have Session instead of Cookies? Since we are explicitly configuring the session cookie and not other potential cookies we might have (for example the one which stores if we are on mobile or desktop view).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose you're right (althought technically I will need to use the same path for the csrf cookie, but that also kinda has something to do with sessions ;-) ), will change accordingly :-)

pano9000 added a commit that referenced this pull request Feb 10, 2025
@pano9000 pano9000 marked this pull request as ready for review February 10, 2025 18:30
@eliandoran eliandoran merged commit 905983e into develop Feb 10, 2025
5 checks passed
@eliandoran eliandoran deleted the feat_custom-cookie-path branch February 10, 2025 21:42
pano9000 added a commit that referenced this pull request Feb 11, 2025
@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Jun 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow setting session cookie path via config

2 participants