Skip to content
This repository was archived by the owner on Nov 22, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/aspnetcore-engine/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export function ngAspnetCoreEngine(options: IEngineOptions): Promise<IEngineRend
.then(factory => {
return renderModuleFactory(factory, {
document: options.document || options.appSelector,
url: options.url || options.request.url,
url: options.url || options.request.absoluteUrl,
Comment thread
CaerusKaru marked this conversation as resolved.
extraProviders: extraProviders
});
})
Expand Down
3 changes: 2 additions & 1 deletion modules/express-engine/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export function ngExpressEngine(setupOptions: NgSetupOptions) {

setupOptions.providers = setupOptions.providers || [];

const req = options.req;
const extraProviders = setupOptions.providers.concat(
options.providers,
getReqResProviders(options.req, options.res),
Expand All @@ -84,7 +85,7 @@ export function ngExpressEngine(setupOptions: NgSetupOptions) {
provide: INITIAL_CONFIG,
useValue: {
document: options.document || getDocument(filePath),
url: options.url || options.req.originalUrl
url: options.url || req.protocol + '://' + (req.get('host') || '') + req.originalUrl
}
}
]);
Expand Down
9 changes: 6 additions & 3 deletions modules/hapi-engine/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ const factoryCacheMap = new Map<Type<{}>, NgModuleFactory<{}>>();
*/
export function ngHapiEngine(options: RenderOptions) {

const req = options.req;
const compilerFactory: CompilerFactory = platformDynamicServer().injector.get(CompilerFactory);
const compiler: Compiler = compilerFactory.createCompiler([
{
Expand All @@ -61,11 +62,13 @@ export function ngHapiEngine(options: RenderOptions) {
}
]);

if (options.req.raw.req.url === undefined) {
if (req.raw.req.url === undefined) {
return Promise.reject(new Error('url is undefined'));
}

const filePath = <string> options.req.raw.req.url;
const rawUrl = req.url;
const filePath = <string> req.raw.req.url;
const url = `${rawUrl.protocol || ''}://${rawUrl.host || ''}${rawUrl.path || ''}`;

options.providers = options.providers || [];

Expand All @@ -84,7 +87,7 @@ export function ngHapiEngine(options: RenderOptions) {
provide: INITIAL_CONFIG,
useValue: {
document: options.document || getDocument(filePath),
url: options.url || filePath
url: options.url || url
}
}
]);
Expand Down