mirror of
https://github.com/jc21/nginx-proxy-manager.git
synced 2024-08-30 18:22:48 +00:00
add forward path prefix to prefix services in a sub path.
This commit is contained in:
parent
fa851b61da
commit
2772489f0d
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" %}
|
||||
|
@ -6,6 +6,7 @@ server {
|
||||
set $forward_scheme "http";
|
||||
set $server "127.0.0.1";
|
||||
set $port "80";
|
||||
set $path_prefix "";
|
||||
|
||||
server_name localhost-nginx-proxy-manager;
|
||||
access_log /data/logs/fallback_access.log standard;
|
||||
|
@ -4,5 +4,5 @@ proxy_set_header X-Forwarded-Scheme $scheme;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_pass $forward_scheme://$server:$port$request_uri;
|
||||
proxy_pass $forward_scheme://$server:$port$path_prefix$request_uri;
|
||||
|
||||
|
@ -54,6 +54,12 @@
|
||||
<input name="forward_port" type="number" class="form-control text-monospace" placeholder="80" value="<%- forward_port %>" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12">
|
||||
<div class="form-group">
|
||||
<label class="form-label"><%- i18n('proxy-hosts','forward-path-prefix') %></label>
|
||||
<input name="forward_path_prefix" type="text" class="form-control text-monospace" placeholder="/" value="<%- forward_path_prefix %>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6 col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="custom-switch">
|
||||
|
@ -43,7 +43,8 @@ module.exports = Mn.View.extend({
|
||||
dns_provider_credentials: 'textarea[name="meta[dns_provider_credentials]"]',
|
||||
propagation_seconds: 'input[name="meta[propagation_seconds]"]',
|
||||
forward_scheme: 'select[name="forward_scheme"]',
|
||||
letsencrypt: '.letsencrypt'
|
||||
letsencrypt: '.letsencrypt',
|
||||
forward_path_prefix: 'input[name="forward_path_prefix"]'
|
||||
},
|
||||
|
||||
regions: {
|
||||
@ -149,6 +150,7 @@ module.exports = Mn.View.extend({
|
||||
let data = this.ui.form.serializeJSON();
|
||||
|
||||
// Add locations
|
||||
console.log(this.locationsCollection.models)
|
||||
data.locations = [];
|
||||
this.locationsCollection.models.forEach((location) => {
|
||||
data.locations.push(location.toJSON());
|
||||
@ -361,6 +363,7 @@ module.exports = Mn.View.extend({
|
||||
// Check wether there are any location defined
|
||||
if (options.model && Array.isArray(options.model.attributes.locations)) {
|
||||
options.model.attributes.locations.forEach((location) => {
|
||||
console.log(location)
|
||||
let m = new ProxyLocationModel.Model(location);
|
||||
this.locationsCollection.add(m);
|
||||
});
|
||||
|
@ -23,7 +23,7 @@
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="text-monospace"><%- forward_scheme %>://<%- forward_host %>:<%- forward_port %></div>
|
||||
<div class="text-monospace"><%- forward_scheme %>://<%- forward_host %>:<%- forward_port %><%- forward_path_prefix %></div>
|
||||
</td>
|
||||
<td>
|
||||
<div><%- certificate && certificate_id ? i18n('ssl', certificate.provider) : i18n('ssl', 'none') %></div>
|
||||
|
@ -48,6 +48,12 @@
|
||||
<input name="forward_port" type="number" class="form-control text-monospace model" placeholder="80" value="<%- forward_port %>" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12">
|
||||
<div class="form-group">
|
||||
<label class="form-label"><%- i18n('proxy-hosts','forward-path-prefix') %></label>
|
||||
<input name="forward_path_prefix" type="text" class="form-control text-monospace model" placeholder="" value="<%- forward_path_prefix %>">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row config">
|
||||
<div class="col-md-12">
|
||||
|
@ -125,6 +125,7 @@
|
||||
"forward-scheme": "Scheme",
|
||||
"forward-host": "Forward Hostname / IP",
|
||||
"forward-port": "Forward Port",
|
||||
"forward-path-prefix": "Forward Path Prefix",
|
||||
"delete": "Delete Proxy Host",
|
||||
"delete-confirm": "Are you sure you want to delete the Proxy host for: <strong>{domains}</strong>?",
|
||||
"help-title": "What is a Proxy Host?",
|
||||
|
@ -10,7 +10,8 @@ const model = Backbone.Model.extend({
|
||||
advanced_config: '',
|
||||
forward_scheme: 'http',
|
||||
forward_host: '',
|
||||
forward_port: '80'
|
||||
forward_port: '80',
|
||||
forward_path_prefix:''
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -12,6 +12,7 @@ const model = Backbone.Model.extend({
|
||||
forward_scheme: 'http',
|
||||
forward_host: '',
|
||||
forward_port: null,
|
||||
forward_path_prefix: '',
|
||||
access_list_id: 0,
|
||||
certificate_id: 0,
|
||||
ssl_forced: false,
|
||||
|
Loading…
Reference in New Issue
Block a user