Title: Allow configuring login cookie with an expiry duration · Issue #7301 · coder/code-server · GitHub
Open Graph Title: Allow configuring login cookie with an expiry duration · Issue #7301 · coder/code-server
X Title: Allow configuring login cookie with an expiry duration · Issue #7301 · coder/code-server
Description: What is your suggestion? Allow configuring an (optional) expiry age for the login cookie so that it persists beyond a browser session. This is handy for not re-entering the password every time. Possible change: https://github.com/coder/c...
Open Graph Description: What is your suggestion? Allow configuring an (optional) expiry age for the login cookie so that it persists beyond a browser session. This is handy for not re-entering the password every time. Pos...
X Description: What is your suggestion? Allow configuring an (optional) expiry age for the login cookie so that it persists beyond a browser session. This is handy for not re-entering the password every time. Pos...
Opengraph URL: https://github.com/coder/code-server/issues/7301
X: @github
Domain: github.com
IPv4 address: 140.82.113.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Allow configuring login cookie with an expiry duration","articleBody":"## What is your suggestion?\n\nAllow configuring an (optional) expiry age for the login cookie so that it persists beyond a browser session. This is handy for not re-entering the password every time.\n\n**Possible change**:\nhttps://github.com/coder/code-server/blob/main/src/node/http.ts#L328\n\n```ts\n...\nreturn {\n domain: getCookieDomain(url.host, req.args[\"proxy-domain\"]),\n path: normalize(url.pathname) || \"/\",\n sameSite: \"lax\",\n // Load, if provided, max age for login cookie. 0 means it becomes a Session cookie (according to Express docs)\n maxAge: getConfigCookieMaxAgeAsMilliseconds() || 0,\n}\n```\n\n## Why do you want this feature?\n\nI want to maintain my login status even after closing the browser (as the Cookie is currently session-only). Say keep the login cookie for a week or a month. Adding a max-age changes the cookie from `Session` to persistent for the given duration using Express' `maxAge` parameter ([docs](https://expressjs.com/en/api.html#res.cookie)).\n\n## Are there any workarounds to get this functionality today?\n\nNo, none directly. User can manually edit the cookie in Devtools\n\n## Are you interested in submitting a PR for this?\n\nI'm not that familiar with how to make new configuration argument and also how the config args are read (there's some middleware for `args` IIRC, but not sure how to use that). But I can give it a go, with some help.\n\nThe above given change should be roughly all that's needed, sans the config reading.\n","author":{"url":"https://github.com/nb-programmer","@type":"Person","name":"nb-programmer"},"datePublished":"2025-04-05T06:37:02Z","url":"https://github.com/coder/code-server/issues/7301"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:e0aa9391-34bd-a522-d385-7cf6446009c5 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BC4C:14562A:55C650:74141F:6B043E1B |
| html-safe-nonce | 2c4a867346dcf10f631d844f16570875a619c90e37218f554508217a0ba647ab |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQzRDOjE0NTYyQTo1NUM2NTA6NzQxNDFGOjZCMDQzRTFCIiwidmlzaXRvcl9pZCI6IjQ1MzIzMzAxOTg3MTIyMDQ4MjciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 4f3074de42b76b077e73582852f8d1ba8684aa5ff7ed55e2958e8e77279529d3 |
| hovercard-subject-tag | issue:2973955595 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/coder/code-server/7301/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0345ced1ab4b0f9c6959aa8a24e8b7bdd97224de57c0a9bb1f47ee40c03e2a25/coder/code-server/issues/7301 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0345ced1ab4b0f9c6959aa8a24e8b7bdd97224de57c0a9bb1f47ee40c03e2a25/coder/code-server/issues/7301 |
| og:image:alt | What is your suggestion? Allow configuring an (optional) expiry age for the login cookie so that it persists beyond a browser session. This is handy for not re-entering the password every time. Pos... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | nb-programmer |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9185ccfefd80c1ff2d9ddcdb0cd2becf46b5a1efbbf30741a895e4bb8de25e64 |
| turbo-cache-control | no-preview |
| go-import | github.com/coder/code-server git https://github.com/coder/code-server.git |
| octolytics-dimension-user_id | 95932066 |
| octolytics-dimension-user_login | coder |
| octolytics-dimension-repository_id | 172953845 |
| octolytics-dimension-repository_nwo | coder/code-server |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 172953845 |
| octolytics-dimension-repository_network_root_nwo | coder/code-server |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 06dc448a76fe4751ac1db26524aefa3aa3e889a8 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width