mirror of
https://git.tuxpa.in/a/code-server.git
synced 2024-12-27 04:35:25 +00:00
Respond when proxy errors
Otherwise the request will just hang.
This commit is contained in:
parent
363cdd02df
commit
a288351ad4
@ -490,7 +490,10 @@ export class HttpServer {
|
|||||||
} else {
|
} else {
|
||||||
this.server = http.createServer(this.onRequest)
|
this.server = http.createServer(this.onRequest)
|
||||||
}
|
}
|
||||||
this.proxy.on("error", (error) => logger.warn(error.message))
|
this.proxy.on("error", (error, _request, response) => {
|
||||||
|
response.writeHead(HttpCode.ServerError)
|
||||||
|
response.end(error.message)
|
||||||
|
})
|
||||||
// Intercept the response to rewrite absolute redirects against the base path.
|
// Intercept the response to rewrite absolute redirects against the base path.
|
||||||
this.proxy.on("proxyRes", (response, request: ProxyRequest) => {
|
this.proxy.on("proxyRes", (response, request: ProxyRequest) => {
|
||||||
if (response.headers.location && response.headers.location.startsWith("/") && request.base) {
|
if (response.headers.location && response.headers.location.startsWith("/") && request.base) {
|
||||||
|
Loading…
Reference in New Issue
Block a user