mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-06-18 18:16:26 +00:00
Added support for redirection and 404 hosts
This commit is contained in:
@ -155,15 +155,14 @@ const internalHost = {
|
||||
*
|
||||
* @param {Object} host
|
||||
* @param {Boolean} [reload_nginx]
|
||||
* @param {Boolean} [force_ssl_renew]
|
||||
* @returns {Promise}
|
||||
*/
|
||||
configure: (host, reload_nginx, force_ssl_renew) => {
|
||||
configure: (host, reload_nginx) => {
|
||||
return new Promise((resolve/*, reject*/) => {
|
||||
resolve(internalNginx.deleteConfig(host));
|
||||
})
|
||||
.then(() => {
|
||||
if (host.ssl && (force_ssl_renew || !internalSsl.hasValidSslCerts(host))) {
|
||||
if (host.ssl && !internalSsl.hasValidSslCerts(host)) {
|
||||
return internalSsl.configureSsl(host);
|
||||
}
|
||||
})
|
||||
@ -248,7 +247,7 @@ const internalHost = {
|
||||
reject(new error.ValidationError('Host does not have SSL enabled'));
|
||||
} else {
|
||||
// 3. Fire the ssl and config generation for this host, forcing ssl
|
||||
internalHost.configure(host, true, true)
|
||||
internalSsl.renewSsl(host)
|
||||
.then((/*result*/) => {
|
||||
resolve(host);
|
||||
})
|
||||
|
@ -45,7 +45,11 @@ const internalNginx = {
|
||||
let filename = internalNginx.getConfigName(host);
|
||||
|
||||
try {
|
||||
template = fs.readFileSync(__dirname + '/../templates/host.conf.ejs', {encoding: 'utf8'});
|
||||
if (typeof host.type === 'undefined' || !host.type) {
|
||||
host.type = 'proxy';
|
||||
}
|
||||
|
||||
template = fs.readFileSync(__dirname + '/../templates/' + host.type + '.conf.ejs', {encoding: 'utf8'});
|
||||
let config_text = ejs.render(template, host);
|
||||
fs.writeFileSync(filename, config_text, {encoding: 'utf8'});
|
||||
resolve(true);
|
||||
|
Reference in New Issue
Block a user