Skip to content

Commit 01371f1

Browse files
UFAL/Update baseHref in the index.html for correct SSR fetching (#944)
1 parent bf8de9e commit 01371f1

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

server.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,10 @@ function serverSideRender(req, res, sendToUser: boolean = true) {
273273
requestUrl: req.originalUrl,
274274
}, (err, data) => {
275275
if (hasNoValue(err) && hasValue(data)) {
276+
// Fix missing base href in SSR output
277+
const baseHref = `${environment.ui.nameSpace}${environment.ui.nameSpace.endsWith('/') ? '' : '/'}`;
278+
data = data.replace(/<base href=".*?">/, `<base href="${baseHref}">`);
279+
276280
// Replace REST URL with UI URL
277281
if (environment.universal.replaceRestUrl && REST_BASE_URL !== environment.rest.baseUrl) {
278282
data = data.replace(new RegExp(REST_BASE_URL, 'g'), environment.rest.baseUrl);

0 commit comments

Comments
 (0)