Skip to content

Commit a34931f

Browse files
committed
Add newly required "allowedHosts" setting for Angular, specifying the UI's hostname. This is now required for SSR to work.
1 parent db0ccb2 commit a34931f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

server.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,11 @@ function ngApp(req, res, next) {
245245
*/
246246
function serverSideRender(req, res, next, sendToUser: boolean = true) {
247247
const { protocol, originalUrl, baseUrl, headers } = req;
248-
const commonEngine = new CommonEngine({ enablePerformanceProfiler: environment.ssr.enablePerformanceProfiler });
248+
// "allowedHosts" specifies which hosts are allowed to be rendered via SSR.
249+
// By default, this is set to the host of the UI's baseUrl.
250+
const commonEngine = new CommonEngine({ enablePerformanceProfiler: environment.ssr.enablePerformanceProfiler,
251+
allowedHosts: [ new URL(environment.ui.baseUrl).hostname ],
252+
});
249253
// Render the page via SSR (server side rendering)
250254
commonEngine
251255
.render({

0 commit comments

Comments
 (0)