diff --git a/server.ts b/server.ts index 4ecedf956f..89428f9bd3 100644 --- a/server.ts +++ b/server.ts @@ -268,6 +268,12 @@ function serverSideRender(req, res, next, sendToUser: boolean = true) { ], }) .then((html) => { + // If headers were already sent, then do nothing else, it is probably a + // redirect response + if (res.headersSent) { + return; + } + if (hasValue(html)) { // Replace REST URL with UI URL if (environment.ssr.replaceRestUrl && REST_BASE_URL !== environment.rest.baseUrl) {