Only serve HTML on specific index.html requests
Otherwise there is risk of an infinite loop through the iframe where the fallback keeps loading the root HTML which itself has an iframe...
This commit is contained in:
parent
4cc181cedc
commit
205775ac97
@ -3,6 +3,7 @@ import * as http from "http"
|
|||||||
import * as React from "react"
|
import * as React from "react"
|
||||||
import * as ReactDOMServer from "react-dom/server"
|
import * as ReactDOMServer from "react-dom/server"
|
||||||
import App from "../../browser/app"
|
import App from "../../browser/app"
|
||||||
|
import { HttpCode, HttpError } from "../../common/http"
|
||||||
import { Options } from "../../common/util"
|
import { Options } from "../../common/util"
|
||||||
import { HttpProvider, HttpResponse, Route } from "../http"
|
import { HttpProvider, HttpResponse, Route } from "../http"
|
||||||
|
|
||||||
@ -21,6 +22,9 @@ export class MainHttpProvider extends HttpProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case "/": {
|
case "/": {
|
||||||
|
if (route.requestPath !== "/index.html") {
|
||||||
|
throw new HttpError("Not found", HttpCode.NotFound)
|
||||||
|
}
|
||||||
const options: Options = {
|
const options: Options = {
|
||||||
authed: !!this.authenticated(request),
|
authed: !!this.authenticated(request),
|
||||||
basePath: this.base(route),
|
basePath: this.base(route),
|
||||||
|
@ -11,6 +11,7 @@ import {
|
|||||||
VscodeOptions,
|
VscodeOptions,
|
||||||
WorkbenchOptions,
|
WorkbenchOptions,
|
||||||
} from "../../../lib/vscode/src/vs/server/ipc"
|
} from "../../../lib/vscode/src/vs/server/ipc"
|
||||||
|
import { HttpCode, HttpError } from "../../common/http"
|
||||||
import { generateUuid } from "../../common/util"
|
import { generateUuid } from "../../common/util"
|
||||||
import { HttpProvider, HttpProviderOptions, HttpResponse, Route } from "../http"
|
import { HttpProvider, HttpProviderOptions, HttpResponse, Route } from "../http"
|
||||||
import { SettingsProvider } from "../settings"
|
import { SettingsProvider } from "../settings"
|
||||||
@ -114,6 +115,9 @@ export class VscodeHttpProvider extends HttpProvider {
|
|||||||
this.ensureAuthenticated(request)
|
this.ensureAuthenticated(request)
|
||||||
switch (route.base) {
|
switch (route.base) {
|
||||||
case "/":
|
case "/":
|
||||||
|
if (route.requestPath !== "/index.html") {
|
||||||
|
throw new HttpError("Not found", HttpCode.NotFound)
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
return await this.getRoot(request, route)
|
return await this.getRoot(request, route)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
Reference in New Issue
Block a user