@reldens/cms 0.30.0 → 0.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,6 +18,10 @@ class RequestProcessor
18
18
 
19
19
  getDomainFromRequest(req)
20
20
  {
21
+ let forwardedHost = req.get('x-forwarded-host');
22
+ if(forwardedHost){
23
+ return forwardedHost.split(':')[0];
24
+ }
21
25
  let host = req.get('host');
22
26
  if(!host){
23
27
  return false;
package/lib/manager.js CHANGED
@@ -75,6 +75,7 @@ class Manager
75
75
  this.frontend = sc.get(props, 'frontend', false);
76
76
  this.renderEngine = sc.get(props, 'renderEngine', mustache);
77
77
  this.prismaClient = sc.get(props, 'prismaClient', false);
78
+ this.domains = sc.get(props, 'domains', []);
78
79
  this.developmentPatterns = sc.get(props, 'developmentPatterns', []);
79
80
  this.developmentEnvironments = sc.get(props, 'developmentEnvironments', []);
80
81
  this.developmentPorts = sc.get(props, 'developmentPorts', []);
@@ -236,7 +237,7 @@ class Manager
236
237
  }
237
238
  let baseConfig = {
238
239
  port: this.config.port,
239
- useHttps: this.determineHttpsUsage(),
240
+ useHttps: this.config.host.startsWith('https://'),
240
241
  useHelmet,
241
242
  domainMapping: this.domainMapping || {},
242
243
  defaultDomain: this.defaultDomain,
@@ -254,15 +255,12 @@ class Manager
254
255
  }
255
256
  this.appServerFactory.setDomainMapping(this.domainMapping);
256
257
  }
257
- return appServerConfig;
258
- }
259
-
260
- determineHttpsUsage()
261
- {
262
- if(this.config.publicUrl && this.config.publicUrl.startsWith('https://')){
263
- return true;
258
+ if(sc.isArray(this.domains) && 0 < this.domains.length){
259
+ for(let domain of this.domains){
260
+ this.appServerFactory.addDomain(domain);
261
+ }
264
262
  }
265
- return this.config.host.startsWith('https://');
263
+ return appServerConfig;
266
264
  }
267
265
 
268
266
  async initializeCmsAfterInstall(props)
@@ -49,6 +49,10 @@ class SystemVariablesProvider
49
49
  if(!customPublicUrl && domain && sc.hasOwn(this.domainPublicUrlMapping, domain)){
50
50
  publicUrl = this.domainPublicUrlMapping[domain];
51
51
  }
52
+ let forwardedHost = req.get('x-forwarded-host');
53
+ if(forwardedHost && sc.hasOwn(this.domainPublicUrlMapping, forwardedHost)){
54
+ publicUrl = this.domainPublicUrlMapping[forwardedHost];
55
+ }
52
56
  if(publicUrl === baseUrl && '' !== this.defaultPublicUrl){
53
57
  publicUrl = this.defaultPublicUrl;
54
58
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@reldens/cms",
3
3
  "scope": "@reldens",
4
- "version": "0.30.0",
4
+ "version": "0.32.0",
5
5
  "description": "Reldens - CMS",
6
6
  "author": "Damian A. Pastorini",
7
7
  "license": "MIT",
@@ -33,8 +33,8 @@
33
33
  "url": "https://github.com/damian-pastorini/reldens-cms/issues"
34
34
  },
35
35
  "dependencies": {
36
- "@reldens/server-utils": "^0.30.0",
37
- "@reldens/storage": "^0.72.0",
36
+ "@reldens/server-utils": "^0.32.0",
37
+ "@reldens/storage": "^0.73.0",
38
38
  "@reldens/utils": "^0.53.0",
39
39
  "dotenv": "17.2.2",
40
40
  "mustache": "4.2.0"