Skip to content

Commit 17f5024

Browse files
authored
Merge pull request #4743 from DSpace/backport-4733-to-dspace-8_x
[Port dspace-8_x] SSR: avoid sending new response when headers were already sent
2 parents a9093aa + 1f8bc7b commit 17f5024

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
@@ -269,6 +269,12 @@ function serverSideRender(req, res, next, sendToUser: boolean = true) {
269269
],
270270
})
271271
.then((html) => {
272+
// If headers were already sent, then do nothing else, it is probably a
273+
// redirect response
274+
if (res.headersSent) {
275+
return;
276+
}
277+
272278
if (hasValue(html)) {
273279
// Replace REST URL with UI URL
274280
if (environment.ssr.replaceRestUrl && REST_BASE_URL !== environment.rest.baseUrl) {

0 commit comments

Comments
 (0)