mirror of
https://github.com/coder/code-server.git
synced 2026-05-24 13:17:28 +02:00
* Fix issue where HTTP error status codes are not read. * Fix issues surrounding sessions when accessed from a proxy. - Updated vscode args to match latest upstream. - Fixed issues surrounding trailing slashes affecting base paths. - Updated cookie names to better match upstream's usage, debuggability. * Bump vendor. * Update tests. * Fix issue where tests lack cookie key. Co-authored-by: Asher <ash@coder.com>
22 lines
724 B
TypeScript
22 lines
724 B
TypeScript
import { Router } from "express"
|
|
import { CookieKeys } from "../../common/http"
|
|
import { getCookieDomain, redirect } from "../http"
|
|
|
|
import { sanitizeString } from "../util"
|
|
|
|
export const router = Router()
|
|
|
|
router.get<{}, undefined, undefined, { base?: string; to?: string }>("/", async (req, res) => {
|
|
const path = sanitizeString(req.query.base) || "/"
|
|
const to = sanitizeString(req.query.to) || "/"
|
|
|
|
// Must use the *identical* properties used to set the cookie.
|
|
res.clearCookie(CookieKeys.Session, {
|
|
domain: getCookieDomain(req.headers.host || "", req.args["proxy-domain"]),
|
|
path: decodeURIComponent(path),
|
|
sameSite: "lax",
|
|
})
|
|
|
|
return redirect(req, res, to, { to: undefined, base: undefined })
|
|
})
|