mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-06-17 17:56:27 +00:00
add forward path prefix to prefix services in a sub path.
This commit is contained in:
42
backend/migrations/20230811144605_forward_path.js
Normal file
42
backend/migrations/20230811144605_forward_path.js
Normal file
@ -0,0 +1,42 @@
|
||||
const migrate_name = 'identifier_for_migrate';
|
||||
const logger = require('../logger').migrate;
|
||||
|
||||
/**
|
||||
* Migrate
|
||||
*
|
||||
* @see http://knexjs.org/#Schema
|
||||
*
|
||||
* @param {Object} knex
|
||||
* @param {Promise} Promise
|
||||
* @returns {Promise}
|
||||
*/
|
||||
exports.up = function (knex, Promise) {
|
||||
|
||||
logger.info('[' + migrate_name + '] Migrating Up...');
|
||||
|
||||
|
||||
return knex.schema.alterTable('proxy_host',function(table){
|
||||
table.string("forward_path_prefix").notNull().defaultTo("");
|
||||
})
|
||||
.then(function() {
|
||||
logger.info('[' + migrate_name + '] Migrating Up Complete');
|
||||
})
|
||||
};
|
||||
|
||||
/**
|
||||
* Undo Migrate
|
||||
*
|
||||
* @param {Object} knex
|
||||
* @param {Promise} Promise
|
||||
* @returns {Promise}
|
||||
*/
|
||||
exports.down = function (knex, Promise) {
|
||||
logger.info('[' + migrate_name + '] Migrating Down...');
|
||||
|
||||
return knex.schema.alterTable("proxy_host", function(table){
|
||||
table.dropColumn('forward_path_prefix');
|
||||
})
|
||||
.then(() => {
|
||||
logger.info('[' + migrate_name + '] Migrating Down Complete');
|
||||
});
|
||||
};
|
@ -32,6 +32,11 @@
|
||||
"minimum": 1,
|
||||
"maximum": 65535
|
||||
},
|
||||
"forward_path_prefix":{
|
||||
"type":"string",
|
||||
"pattern": "^(\/[^/]+)*$",
|
||||
"maxLength":255
|
||||
},
|
||||
"certificate_id": {
|
||||
"$ref": "../definitions.json#/definitions/certificate_id"
|
||||
},
|
||||
@ -102,6 +107,10 @@
|
||||
"forward_path": {
|
||||
"type": "string"
|
||||
},
|
||||
"forward_path_prefix":{
|
||||
"type":"string",
|
||||
"pattern": "^(\/[^/]+)*$"
|
||||
},
|
||||
"advanced_config": {
|
||||
"type": "string"
|
||||
}
|
||||
@ -221,6 +230,9 @@
|
||||
"forward_port": {
|
||||
"$ref": "#/definitions/forward_port"
|
||||
},
|
||||
"forward_path_prefix":{
|
||||
"$ref": "#/definitions/forward_path_prefix"
|
||||
},
|
||||
"certificate_id": {
|
||||
"$ref": "#/definitions/certificate_id"
|
||||
},
|
||||
@ -294,6 +306,9 @@
|
||||
"forward_port": {
|
||||
"$ref": "#/definitions/forward_port"
|
||||
},
|
||||
"forward_path_prefix":{
|
||||
"$ref": "#/definitions/forward_path_prefix"
|
||||
},
|
||||
"certificate_id": {
|
||||
"$ref": "#/definitions/certificate_id"
|
||||
},
|
||||
|
@ -4,7 +4,7 @@
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Forwarded-For $remote_addr;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_pass {{ forward_scheme }}://{{ forward_host }}:{{ forward_port }}{{ forward_path }};
|
||||
proxy_pass {{ forward_scheme }}://{{ forward_host }}:{{ forward_port }}{{ forward_path_prefix }}{{ forward_path }};
|
||||
|
||||
{% include "_access.conf" %}
|
||||
{% include "_assets.conf" %}
|
||||
|
@ -5,6 +5,7 @@ server {
|
||||
set $forward_scheme {{ forward_scheme }};
|
||||
set $server "{{ forward_host }}";
|
||||
set $port {{ forward_port }};
|
||||
set $path_prefix "{{ forward_path_prefix }}";
|
||||
|
||||
{% include "_listen.conf" %}
|
||||
{% include "_certificates.conf" %}
|
||||
|
Reference in New Issue
Block a user