mirror of
https://github.com/coder/code-server.git
synced 2026-05-05 03:55:18 +02:00
Update path syntax for Express
It seems that * matches a literal * now, so we have to use a regular expression. Parentheses around a parameter no longer works (it causes it to match on the parameter name literally) and I am not sure why we had it anyway as it had no effect previously. Matching with a leading / does not appear to work either, but we do not need the leading / anyway since the proxy logic was changed to use the whole path. Consequently it will never be / anymore from what I can tell but I left that check in just in case. I turned it into a named parameter as well, because that seems better.
This commit is contained in:
@@ -53,7 +53,7 @@ const maybeProxy = (req: Request): string | undefined => {
|
||||
return undefined
|
||||
}
|
||||
|
||||
router.all("*", async (req, res, next) => {
|
||||
router.all(/.*/, async (req, res, next) => {
|
||||
const port = maybeProxy(req)
|
||||
if (!port) {
|
||||
return next()
|
||||
@@ -97,7 +97,7 @@ router.all("*", async (req, res, next) => {
|
||||
|
||||
export const wsRouter = WsRouter()
|
||||
|
||||
wsRouter.ws("*", async (req, _, next) => {
|
||||
wsRouter.ws(/.*/, async (req, _, next) => {
|
||||
const port = maybeProxy(req)
|
||||
if (!port) {
|
||||
return next()
|
||||
|
||||
Reference in New Issue
Block a user