This repository was archived by the owner on Nov 22, 2024. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -128,7 +128,7 @@ export function ngAspnetCoreEngine(options: IEngineOptions): Promise<IEngineRend
128128 . then ( factory => {
129129 return renderModuleFactory ( factory , {
130130 document : options . document || options . appSelector ,
131- url : options . url || options . request . url ,
131+ url : options . url || options . request . absoluteUrl ,
132132 extraProviders : extraProviders
133133 } ) ;
134134 } )
Original file line number Diff line number Diff line change @@ -76,6 +76,7 @@ export function ngExpressEngine(setupOptions: NgSetupOptions) {
7676
7777 setupOptions . providers = setupOptions . providers || [ ] ;
7878
79+ const req = options . req ;
7980 const extraProviders = setupOptions . providers . concat (
8081 options . providers ,
8182 getReqResProviders ( options . req , options . res ) ,
@@ -84,7 +85,7 @@ export function ngExpressEngine(setupOptions: NgSetupOptions) {
8485 provide : INITIAL_CONFIG ,
8586 useValue : {
8687 document : options . document || getDocument ( filePath ) ,
87- url : options . url || options . req . originalUrl
88+ url : options . url || req . protocol + '://' + ( req . get ( 'host' ) || '' ) + req . originalUrl
8889 }
8990 }
9091 ] ) ;
Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ const factoryCacheMap = new Map<Type<{}>, NgModuleFactory<{}>>();
5252 */
5353export function ngHapiEngine ( options : RenderOptions ) {
5454
55+ const req = options . req ;
5556 const compilerFactory : CompilerFactory = platformDynamicServer ( ) . injector . get ( CompilerFactory ) ;
5657 const compiler : Compiler = compilerFactory . createCompiler ( [
5758 {
@@ -61,11 +62,13 @@ export function ngHapiEngine(options: RenderOptions) {
6162 }
6263 ] ) ;
6364
64- if ( options . req . raw . req . url === undefined ) {
65+ if ( req . raw . req . url === undefined ) {
6566 return Promise . reject ( new Error ( 'url is undefined' ) ) ;
6667 }
6768
68- const filePath = < string > options . req . raw . req . url ;
69+ const rawUrl = req . url ;
70+ const filePath = < string > req . raw . req . url ;
71+ const url = `${ rawUrl . protocol || '' } ://${ rawUrl . host || '' } ${ rawUrl . path || '' } ` ;
6972
7073 options . providers = options . providers || [ ] ;
7174
@@ -84,7 +87,7 @@ export function ngHapiEngine(options: RenderOptions) {
8487 provide : INITIAL_CONFIG ,
8588 useValue : {
8689 document : options . document || getDocument ( filePath ) ,
87- url : options . url || filePath
90+ url : options . url || url
8891 }
8992 }
9093 ] ) ;
You can’t perform that action at this time.
0 commit comments