Skip to content

Commit 20a468d

Browse files
authored
Merge pull request #4744 from DSpace/backport-4733-to-dspace-9_x
[Port dspace-9_x] SSR: avoid sending new response when headers were already sent
2 parents 177d57b + 99244c4 commit 20a468d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

server.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,12 @@ function serverSideRender(req, res, next, sendToUser: boolean = true) {
268268
],
269269
})
270270
.then((html) => {
271+
// If headers were already sent, then do nothing else, it is probably a
272+
// redirect response
273+
if (res.headersSent) {
274+
return;
275+
}
276+
271277
if (hasValue(html)) {
272278
// Replace REST URL with UI URL
273279
if (environment.ssr.replaceRestUrl && REST_BASE_URL !== environment.rest.baseUrl) {

0 commit comments

Comments
 (0)