Skip to content

Commit 60162af

Browse files
committed
add disable-origin-check flag
1 parent 7f024ed commit 60162af

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/node/cli.ts

+7
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ export interface UserProvidedCodeArgs {
4747
"show-versions"?: boolean
4848
category?: string
4949
"github-auth"?: string
50+
"disable-authenticate-origin"?: boolean
5051
"disable-update-check"?: boolean
5152
"disable-file-downloads"?: boolean
5253
"disable-workspace-trust"?: boolean
@@ -164,6 +165,12 @@ export const options: Options<Required<UserProvidedArgs>> = {
164165
"session-socket": {
165166
type: "string",
166167
},
168+
"disable-authenticate-origin": {
169+
type: "boolean",
170+
description:
171+
"Disable check that the origin of the request is the same as the host. Notice that this disables a safety feature. \n" +
172+
"(Useful when using a reverse proxy)",
173+
},
167174
"disable-file-downloads": {
168175
type: "boolean",
169176
description:

src/node/http.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,9 @@ function getFirstHeader(req: http.IncomingMessage, headerName: string): string |
327327
*/
328328
export function ensureOrigin(req: express.Request, _?: express.Response, next?: express.NextFunction): void {
329329
try {
330-
authenticateOrigin(req)
330+
if (!req.args["disable-authenticate-origin"]) {
331+
authenticateOrigin(req)
332+
}
331333
if (next) {
332334
next()
333335
}

0 commit comments

Comments
 (0)