Skip to content

Commit f653b51

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 fa51a6d commit f653b51

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

server.ts

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

0 commit comments

Comments
 (0)