Skip to content

refactor: default cookie path to CHAINLIT_ROOT_PATH if set #2311

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

dominpm
Copy link
Contributor

@dominpm dominpm commented Jul 23, 2025

Description

This PR follows up on #2207 to refine how the authentication cookie path is determined.

What's Changed

  • If CHAINLIT_ROOT_PATH is defined, it is now used as the default value for the cookie path.
  • This takes precedence over the CHAINLIT_COOKIE_PATH env var (which still remains configurable).
  • Maintains backward compatibility: if neither is set, the path defaults to /.

Why

In deployments where CHAINLIT_ROOT_PATH is used to scope all routes, it makes more sense for cookies to follow the same base path by default — ensuring consistent scoping without requiring extra configuration.

Notes

@hayescode as discussed in #2207 — this follows up. (The other PR was automatically merged and closed) Let me know if you'd like to adjust anything further!

@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. auth Pertaining to authentication. labels Jul 23, 2025
@asvishnyakov asvishnyakov changed the title refactor pr 2207 : default cookie path to CHAINLIT_ROOT_PATH if set refactor: default cookie path to CHAINLIT_ROOT_PATH if set Jul 23, 2025
@asvishnyakov
Copy link
Contributor

@hayescode @dominpm Before you merge and release this, keep in mind Chainlit set multiple cookies (I know at least about the one for affinity sessions) which DOES NOT respect auth cookie settings (which is a separate issue). So I think the proper name for variable is CHAINLIT_AUTH_COOKIE_PATH

@dominpm
Copy link
Contributor Author

dominpm commented Jul 29, 2025

Hi @hayescode , just edited the change for the env var name in the PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auth Pertaining to authentication. size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants