Add field to configure the reverse proxy

part of #596
This commit is contained in:
Girish Ramakrishnan
2019-10-13 18:22:03 -07:00
parent 7383cc4e90
commit 9c12f1fe15
11 changed files with 177 additions and 42 deletions

View File

@@ -464,6 +464,12 @@ function writeAppNginxConfig(app, bundle, callback) {
var sourceDir = path.resolve(__dirname, '..');
var endpoint = 'app';
let frameAncestorsQuoted = null, robotsTxtQuoted = null, hiddenUpstreamHeaders = [];
const reverseProxyConfig = app.reverseProxyConfig || {}; // some of our code uses fake app objects
if (reverseProxyConfig.robotsTxt) robotsTxtQuoted = JSON.stringify(app.reverseProxyConfig.robotsTxt);
if (reverseProxyConfig.frameAncestors) frameAncestorsQuoted = app.reverseProxyConfig.frameAncestors.map(fa => `'${fa}'`).join(' ');
if (reverseProxyConfig.hideHeaders) hiddenUpstreamHeaders = app.reverseProxyConfig.hideHeaders;
var data = {
sourceDir: sourceDir,
adminOrigin: settings.adminOrigin(),
@@ -473,7 +479,9 @@ function writeAppNginxConfig(app, bundle, callback) {
endpoint: endpoint,
certFilePath: bundle.certFilePath,
keyFilePath: bundle.keyFilePath,
robotsTxtQuoted: app.robotsTxt ? JSON.stringify(app.robotsTxt) : null
robotsTxtQuoted,
frameAncestorsQuoted,
hiddenUpstreamHeaders
};
var nginxConf = ejs.render(NGINX_APPCONFIG_EJS, data);
@@ -502,7 +510,9 @@ function writeAppRedirectNginxConfig(app, fqdn, bundle, callback) {
endpoint: 'redirect',
certFilePath: bundle.certFilePath,
keyFilePath: bundle.keyFilePath,
robotsTxtQuoted: null
robotsTxtQuoted: null,
frameAncestorsQuoted: null,
hiddenUpstreamHeaders: []
};
var nginxConf = ejs.render(NGINX_APPCONFIG_EJS, data);