mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-06-18 10:06:26 +00:00
Add support for PROXY protocol on streams
This commit is contained in:
41
backend/migrations/20240310100432_proxy_protocol_streams.js
Normal file
41
backend/migrations/20240310100432_proxy_protocol_streams.js
Normal file
@ -0,0 +1,41 @@
|
||||
const migrate_name = 'proxy_protocol_streams';
|
||||
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.table('stream', function (stream) {
|
||||
stream.integer('enable_proxy_protocol').notNull().unsigned().defaultTo(0);
|
||||
stream.string('load_balancer_ip').notNull().defaultTo('');
|
||||
})
|
||||
.then(() => {
|
||||
logger.info('[' + migrate_name + '] stream Table altered');
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Undo Migrate
|
||||
*
|
||||
* @param {Object} knex
|
||||
* @param {Promise} Promise
|
||||
* @returns {Promise}
|
||||
*/
|
||||
exports.down = function (knex/*, Promise*/) {
|
||||
return knex.schema.table('stream', function (stream) {
|
||||
stream.dropColumn('enable_proxy_protocol');
|
||||
stream.dropColumn('load_balancer_ip');
|
||||
})
|
||||
.then(function () {
|
||||
logger.info('[' + migrate_name + '] stream Table altered');
|
||||
});
|
||||
};
|
@ -46,6 +46,16 @@
|
||||
"udp_forwarding": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"enable_proxy_protocol": {
|
||||
"description": "Enable PROXY Protocol support",
|
||||
"example": true,
|
||||
"type": "boolean"
|
||||
},
|
||||
"load_balancer_ip": {
|
||||
"type": "string",
|
||||
"minLength": 0,
|
||||
"maxLength": 255
|
||||
},
|
||||
"enabled": {
|
||||
"$ref": "../definitions.json#/definitions/enabled"
|
||||
},
|
||||
@ -78,6 +88,12 @@
|
||||
"udp_forwarding": {
|
||||
"$ref": "#/definitions/udp_forwarding"
|
||||
},
|
||||
"enable_proxy_protocol": {
|
||||
"$ref": "#/definitions/enable_proxy_protocol"
|
||||
},
|
||||
"load_balancer_ip": {
|
||||
"$ref": "#/definitions/load_balancer_ip"
|
||||
},
|
||||
"enabled": {
|
||||
"$ref": "#/definitions/enabled"
|
||||
},
|
||||
@ -137,6 +153,12 @@
|
||||
"udp_forwarding": {
|
||||
"$ref": "#/definitions/udp_forwarding"
|
||||
},
|
||||
"enable_proxy_protocol": {
|
||||
"$ref": "#/definitions/enable_proxy_protocol"
|
||||
},
|
||||
"load_balancer_ip": {
|
||||
"$ref": "#/definitions/load_balancer_ip"
|
||||
},
|
||||
"meta": {
|
||||
"$ref": "#/definitions/meta"
|
||||
}
|
||||
@ -177,6 +199,12 @@
|
||||
"udp_forwarding": {
|
||||
"$ref": "#/definitions/udp_forwarding"
|
||||
},
|
||||
"enable_proxy_protocol": {
|
||||
"$ref": "#/definitions/enable_proxy_protocol"
|
||||
},
|
||||
"load_balancer_ip": {
|
||||
"$ref": "#/definitions/load_balancer_ip"
|
||||
},
|
||||
"meta": {
|
||||
"$ref": "#/definitions/meta"
|
||||
}
|
||||
|
@ -1,31 +1,38 @@
|
||||
# ------------------------------------------------------------
|
||||
# {{ incoming_port }} TCP: {{ tcp_forwarding }} UDP: {{ udp_forwarding }}
|
||||
# ------------------------------------------------------------
|
||||
{% if enable_proxy_protocol == 1 or enable_proxy_protocol == true -%}
|
||||
{% capture listen_extra_args %}proxy_protocol{% endcapture -%}
|
||||
{% endif -%}
|
||||
|
||||
{% if enabled %}
|
||||
{% if tcp_forwarding == 1 or tcp_forwarding == true -%}
|
||||
server {
|
||||
listen {{ incoming_port }};
|
||||
listen {{ incoming_port }} {{ listen_extra_args }};
|
||||
{% if ipv6 -%}
|
||||
listen [::]:{{ incoming_port }};
|
||||
listen [::]:{{ incoming_port }} {{ listen_extra_args }};
|
||||
{% else -%}
|
||||
#listen [::]:{{ incoming_port }};
|
||||
#listen [::]:{{ incoming_port }} {{ listen_extra_args }};
|
||||
{% endif %}
|
||||
|
||||
proxy_pass {{ forwarding_host }}:{{ forwarding_port }};
|
||||
|
||||
{% include '_proxy_protocol.conf' %}
|
||||
|
||||
# Custom
|
||||
include /data/nginx/custom/server_stream[.]conf;
|
||||
include /data/nginx/custom/server_stream_tcp[.]conf;
|
||||
}
|
||||
{% endif %}
|
||||
{% if udp_forwarding == 1 or udp_forwarding == true %}
|
||||
{% # Proxy Protocol is not supported for UDP %}
|
||||
{% assign listen_extra_args = "" %}
|
||||
server {
|
||||
listen {{ incoming_port }} udp;
|
||||
listen {{ incoming_port }} udp {{ listen_extra_args }};
|
||||
{% if ipv6 -%}
|
||||
listen [::]:{{ incoming_port }} udp;
|
||||
listen [::]:{{ incoming_port }} udp {{ listen_extra_args }};
|
||||
{% else -%}
|
||||
#listen [::]:{{ incoming_port }} udp;
|
||||
#listen [::]:{{ incoming_port }} udp {{ listen_extra_args }};
|
||||
{% endif %}
|
||||
proxy_pass {{ forwarding_host }}:{{ forwarding_port }};
|
||||
|
||||
|
Reference in New Issue
Block a user