File tree 3 files changed +9
-5
lines changed
3 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -128,7 +128,7 @@ export function ngAspnetCoreEngine(options: IEngineOptions): Promise<IEngineRend
128
128
. then ( factory => {
129
129
return renderModuleFactory ( factory , {
130
130
document : options . document || options . appSelector ,
131
- url : options . url || options . request . url ,
131
+ url : options . url || options . request . absoluteUrl ,
132
132
extraProviders : extraProviders
133
133
} ) ;
134
134
} )
Original file line number Diff line number Diff line change @@ -76,6 +76,7 @@ export function ngExpressEngine(setupOptions: NgSetupOptions) {
76
76
77
77
setupOptions . providers = setupOptions . providers || [ ] ;
78
78
79
+ const req = options . req ;
79
80
const extraProviders = setupOptions . providers . concat (
80
81
options . providers ,
81
82
getReqResProviders ( options . req , options . res ) ,
@@ -84,7 +85,7 @@ export function ngExpressEngine(setupOptions: NgSetupOptions) {
84
85
provide : INITIAL_CONFIG ,
85
86
useValue : {
86
87
document : options . document || getDocument ( filePath ) ,
87
- url : options . url || options . req . originalUrl
88
+ url : options . url || req . protocol + '://' + ( req . get ( 'host' ) || '' ) + req . originalUrl
88
89
}
89
90
}
90
91
] ) ;
Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ const factoryCacheMap = new Map<Type<{}>, NgModuleFactory<{}>>();
52
52
*/
53
53
export function ngHapiEngine ( options : RenderOptions ) {
54
54
55
+ const req = options . req ;
55
56
const compilerFactory : CompilerFactory = platformDynamicServer ( ) . injector . get ( CompilerFactory ) ;
56
57
const compiler : Compiler = compilerFactory . createCompiler ( [
57
58
{
@@ -61,11 +62,13 @@ export function ngHapiEngine(options: RenderOptions) {
61
62
}
62
63
] ) ;
63
64
64
- if ( options . req . raw . req . url === undefined ) {
65
+ if ( req . raw . req . url === undefined ) {
65
66
return Promise . reject ( new Error ( 'url is undefined' ) ) ;
66
67
}
67
68
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 || '' } ` ;
69
72
70
73
options . providers = options . providers || [ ] ;
71
74
@@ -84,7 +87,7 @@ export function ngHapiEngine(options: RenderOptions) {
84
87
provide : INITIAL_CONFIG ,
85
88
useValue : {
86
89
document : options . document || getDocument ( filePath ) ,
87
- url : options . url || filePath
90
+ url : options . url || url
88
91
}
89
92
}
90
93
] ) ;
You can’t perform that action at this time.
0 commit comments