mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-06-18 10:06:26 +00:00
Compare commits
7 Commits
dependabot
...
7912119d14
Author | SHA1 | Date | |
---|---|---|---|
7912119d14 | |||
671817d640 | |||
c39e580e81 | |||
da29cd2e0e | |||
72abe50799 | |||
a92624d086 | |||
c6465a5090 |
@ -101,6 +101,11 @@ Immediately after logging in with this default user you will be asked to modify
|
|||||||
|
|
||||||
All are welcome to create pull requests for this project, against the `develop` branch. Official releases are created from the `master` branch.
|
All are welcome to create pull requests for this project, against the `develop` branch. Official releases are created from the `master` branch.
|
||||||
|
|
||||||
|
Run the following commands to test locally:
|
||||||
|
|
||||||
|
- `cd backend && npm i && node_modules/eslint/bin/eslint.js .`
|
||||||
|
- `cd test && npm i && npm run cypress`
|
||||||
|
|
||||||
CI is used in this project. All PR's must pass before being considered. After passing,
|
CI is used in this project. All PR's must pass before being considered. After passing,
|
||||||
docker builds for PR's are available on dockerhub for manual verifications.
|
docker builds for PR's are available on dockerhub for manual verifications.
|
||||||
|
|
||||||
|
@ -155,6 +155,7 @@ const internalNginx = {
|
|||||||
let locationCopy = Object.assign({}, {access_list_id: host.access_list_id}, {certificate_id: host.certificate_id},
|
let locationCopy = Object.assign({}, {access_list_id: host.access_list_id}, {certificate_id: host.certificate_id},
|
||||||
{ssl_forced: host.ssl_forced}, {caching_enabled: host.caching_enabled}, {block_exploits: host.block_exploits},
|
{ssl_forced: host.ssl_forced}, {caching_enabled: host.caching_enabled}, {block_exploits: host.block_exploits},
|
||||||
{allow_websocket_upgrade: host.allow_websocket_upgrade}, {http2_support: host.http2_support},
|
{allow_websocket_upgrade: host.allow_websocket_upgrade}, {http2_support: host.http2_support},
|
||||||
|
{enable_proxy_protocol: host.enable_proxy_protocol}, {load_balancer_ip: host.load_balancer_ip},
|
||||||
{hsts_enabled: host.hsts_enabled}, {hsts_subdomains: host.hsts_subdomains}, {access_list: host.access_list},
|
{hsts_enabled: host.hsts_enabled}, {hsts_subdomains: host.hsts_subdomains}, {access_list: host.access_list},
|
||||||
{certificate: host.certificate}, host.locations[i]);
|
{certificate: host.certificate}, host.locations[i]);
|
||||||
|
|
||||||
|
41
backend/migrations/20240310085523_proxy_protocol.js
Normal file
41
backend/migrations/20240310085523_proxy_protocol.js
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
const migrate_name = 'proxy_protocol';
|
||||||
|
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('proxy_host', function (proxy_host) {
|
||||||
|
proxy_host.integer('enable_proxy_protocol').notNull().unsigned().defaultTo(0);
|
||||||
|
proxy_host.string('load_balancer_ip').notNull().defaultTo('');
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
logger.info('[' + migrate_name + '] proxy_host Table altered');
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Undo Migrate
|
||||||
|
*
|
||||||
|
* @param {Object} knex
|
||||||
|
* @param {Promise} Promise
|
||||||
|
* @returns {Promise}
|
||||||
|
*/
|
||||||
|
exports.down = function (knex/*, Promise*/) {
|
||||||
|
return knex.schema.table('proxy_host', function (proxy_host) {
|
||||||
|
proxy_host.dropColumn('enable_proxy_protocol');
|
||||||
|
proxy_host.dropColumn('load_balancer_ip');
|
||||||
|
})
|
||||||
|
.then(function () {
|
||||||
|
logger.info('[' + migrate_name + '] proxy_host Table altered');
|
||||||
|
});
|
||||||
|
};
|
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');
|
||||||
|
});
|
||||||
|
};
|
@ -1,15 +1,24 @@
|
|||||||
listen 80;
|
{% if enable_proxy_protocol == 1 or enable_proxy_protocol == true -%}
|
||||||
{% if ipv6 -%}
|
{% assign port_number_http = "88" -%}
|
||||||
listen [::]:80;
|
{% assign port_number_https = "444" -%}
|
||||||
|
{% assign listen_extra_args = "proxy_protocol" -%}
|
||||||
{% else -%}
|
{% else -%}
|
||||||
#listen [::]:80;
|
{% assign port_number_http = "80" -%}
|
||||||
{% endif %}
|
{% assign port_number_https = "443" -%}
|
||||||
|
{% assign listen_extra_args = "" -%}
|
||||||
|
{% endif -%}
|
||||||
|
|
||||||
|
listen {{ port_number_http }} {{ listen_extra_args }};
|
||||||
|
{% if ipv6 -%}
|
||||||
|
listen [::]:{{ port_number_http }} {{ listen_extra_args }};
|
||||||
|
{% endif -%}
|
||||||
|
|
||||||
{% if certificate -%}
|
{% if certificate -%}
|
||||||
listen 443 ssl{% if http2_support == 1 or http2_support == true %} http2{% endif %};
|
{% capture listen_extra_args_https %}ssl{% if http2_support %} http2{% endif %} {{ listen_extra_args }}{% endcapture -%}
|
||||||
|
listen {{ port_number_https }} {{ listen_extra_args_https }};
|
||||||
{% if ipv6 -%}
|
{% if ipv6 -%}
|
||||||
listen [::]:443 ssl{% if http2_support == 1 or http2_support == true %} http2{% endif %};
|
listen [::]:{{ port_number_https }} {{ listen_extra_args_https }};
|
||||||
{% else -%}
|
{% endif -%}
|
||||||
#listen [::]:443;
|
{% endif -%}
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
||||||
server_name {{ domain_names | join: " " }};
|
server_name {{ domain_names | join: " " }};
|
||||||
|
6
backend/templates/_proxy_protocol.conf
Normal file
6
backend/templates/_proxy_protocol.conf
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{% if enable_proxy_protocol == 1 or enable_proxy_protocol == true %}
|
||||||
|
{% if load_balancer_ip != '' %}
|
||||||
|
set_real_ip_from {{ load_balancer_ip }};
|
||||||
|
real_ip_header proxy_protocol;
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
@ -15,6 +15,7 @@ server {
|
|||||||
{% include "_exploits.conf" %}
|
{% include "_exploits.conf" %}
|
||||||
{% include "_hsts.conf" %}
|
{% include "_hsts.conf" %}
|
||||||
{% include "_forced_ssl.conf" %}
|
{% include "_forced_ssl.conf" %}
|
||||||
|
{% include "_proxy_protocol.conf" %}
|
||||||
|
|
||||||
{% if allow_websocket_upgrade == 1 or allow_websocket_upgrade == true %}
|
{% if allow_websocket_upgrade == 1 or allow_websocket_upgrade == true %}
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
@ -1,31 +1,38 @@
|
|||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
# {{ incoming_port }} TCP: {{ tcp_forwarding }} UDP: {{ udp_forwarding }}
|
# {{ 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 enabled %}
|
||||||
{% if tcp_forwarding == 1 or tcp_forwarding == true -%}
|
{% if tcp_forwarding == 1 or tcp_forwarding == true -%}
|
||||||
server {
|
server {
|
||||||
listen {{ incoming_port }};
|
listen {{ incoming_port }} {{ listen_extra_args }};
|
||||||
{% if ipv6 -%}
|
{% if ipv6 -%}
|
||||||
listen [::]:{{ incoming_port }};
|
listen [::]:{{ incoming_port }} {{ listen_extra_args }};
|
||||||
{% else -%}
|
{% else -%}
|
||||||
#listen [::]:{{ incoming_port }};
|
#listen [::]:{{ incoming_port }} {{ listen_extra_args }};
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
proxy_pass {{ forwarding_host }}:{{ forwarding_port }};
|
proxy_pass {{ forwarding_host }}:{{ forwarding_port }};
|
||||||
|
|
||||||
|
{% include '_proxy_protocol.conf' %}
|
||||||
|
|
||||||
# Custom
|
# Custom
|
||||||
include /data/nginx/custom/server_stream[.]conf;
|
include /data/nginx/custom/server_stream[.]conf;
|
||||||
include /data/nginx/custom/server_stream_tcp[.]conf;
|
include /data/nginx/custom/server_stream_tcp[.]conf;
|
||||||
}
|
}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if udp_forwarding == 1 or udp_forwarding == true %}
|
{% if udp_forwarding == 1 or udp_forwarding == true %}
|
||||||
|
{% # Proxy Protocol is not supported for UDP %}
|
||||||
|
{% assign listen_extra_args = "" %}
|
||||||
server {
|
server {
|
||||||
listen {{ incoming_port }} udp;
|
listen {{ incoming_port }} udp {{ listen_extra_args }};
|
||||||
{% if ipv6 -%}
|
{% if ipv6 -%}
|
||||||
listen [::]:{{ incoming_port }} udp;
|
listen [::]:{{ incoming_port }} udp {{ listen_extra_args }};
|
||||||
{% else -%}
|
{% else -%}
|
||||||
#listen [::]:{{ incoming_port }} udp;
|
#listen [::]:{{ incoming_port }} udp {{ listen_extra_args }};
|
||||||
{% endif %}
|
{% endif %}
|
||||||
proxy_pass {{ forwarding_host }}:{{ forwarding_port }};
|
proxy_pass {{ forwarding_host }}:{{ forwarding_port }};
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ RUN echo "fs.file-max = 65535" > /etc/sysctl.conf \
|
|||||||
COPY docker/scripts/install-s6 /tmp/install-s6
|
COPY docker/scripts/install-s6 /tmp/install-s6
|
||||||
RUN /tmp/install-s6 "${TARGETPLATFORM}" && rm -f /tmp/install-s6
|
RUN /tmp/install-s6 "${TARGETPLATFORM}" && rm -f /tmp/install-s6
|
||||||
|
|
||||||
EXPOSE 80 81 443
|
EXPOSE 80 81 88 443 444
|
||||||
|
|
||||||
COPY backend /app
|
COPY backend /app
|
||||||
COPY frontend/dist /app/frontend
|
COPY frontend/dist /app/frontend
|
||||||
|
@ -35,5 +35,5 @@ RUN rm -f /etc/nginx/conf.d/production.conf \
|
|||||||
COPY --from=pebbleca /test/certs/pebble.minica.pem /etc/ssl/certs/pebble.minica.pem
|
COPY --from=pebbleca /test/certs/pebble.minica.pem /etc/ssl/certs/pebble.minica.pem
|
||||||
COPY --from=testca /home/step/certs/root_ca.crt /etc/ssl/certs/NginxProxyManager.crt
|
COPY --from=testca /home/step/certs/root_ca.crt /etc/ssl/certs/NginxProxyManager.crt
|
||||||
|
|
||||||
EXPOSE 80 81 443
|
EXPOSE 80 81 88 443 444
|
||||||
ENTRYPOINT [ "/init" ]
|
ENTRYPOINT [ "/init" ]
|
||||||
|
@ -10,7 +10,9 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- 3080:80
|
- 3080:80
|
||||||
- 3081:81
|
- 3081:81
|
||||||
|
- 3088:88
|
||||||
- 3443:443
|
- 3443:443
|
||||||
|
- 3444:444
|
||||||
networks:
|
networks:
|
||||||
nginx_proxy_manager:
|
nginx_proxy_manager:
|
||||||
aliases:
|
aliases:
|
||||||
|
@ -214,6 +214,29 @@ You can customise the logrotate configuration through a mount (if your custom co
|
|||||||
|
|
||||||
For reference, the default configuration can be found [here](https://github.com/NginxProxyManager/nginx-proxy-manager/blob/develop/docker/rootfs/etc/logrotate.d/nginx-proxy-manager).
|
For reference, the default configuration can be found [here](https://github.com/NginxProxyManager/nginx-proxy-manager/blob/develop/docker/rootfs/etc/logrotate.d/nginx-proxy-manager).
|
||||||
|
|
||||||
|
## Enabling PROXY protocol for Proxy Hosts
|
||||||
|
|
||||||
|
When running NPM behind a load balancer, you might want to use the [PROXY procotol](https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt) to receive client information such as the source IP address (useful for banning IPs).
|
||||||
|
|
||||||
|
When configuring the PROXY protocol for proxy hosts, NPM uses the ports 88 for http and 444 for https traffic to allow you to decide on a per host basis whether to use the PROSY protocol.
|
||||||
|
|
||||||
|
To enable the PROXY protocol for your hosts you need to perform the following steps:
|
||||||
|
|
||||||
|
1. Expose the ports `88` (and `444` is applicable) by adjusting your `docker-compose.yml`
|
||||||
|
2. Edit your proxy hosts to enable the PROXY protocol
|
||||||
|
3. Edit your upstream load balancer to redirect traffic to the port `88`/`444` and enable the PROXY protocol
|
||||||
|
|
||||||
|
## Enabling PROXY protocol for Streams
|
||||||
|
|
||||||
|
When running NPM behind a load balancer, you might want to use the [PROXY procotol](https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt) to receive client information such as the source IP address (useful for banning IPs).
|
||||||
|
|
||||||
|
Keep in mind that the PROXY procotol cannot be enabled for udp endpoints.
|
||||||
|
|
||||||
|
To enable the PROXY protocol for streams:
|
||||||
|
|
||||||
|
1. Expose the desired port by adjusting you `docker-compose.yml`
|
||||||
|
2. Edit the Stream to enable the PROXY protocol
|
||||||
|
3. Edit your upstream load balancer to enable the PROXY protocol
|
||||||
## Enabling the geoip2 module
|
## Enabling the geoip2 module
|
||||||
|
|
||||||
To enable the geoip2 module, you can create the custom configuration file `/data/nginx/custom/root_top.conf` and include the following snippet:
|
To enable the geoip2 module, you can create the custom configuration file `/data/nginx/custom/root_top.conf` and include the following snippet:
|
||||||
|
@ -65,6 +65,8 @@ services:
|
|||||||
- '80:80' # Public HTTP Port
|
- '80:80' # Public HTTP Port
|
||||||
- '443:443' # Public HTTPS Port
|
- '443:443' # Public HTTPS Port
|
||||||
- '81:81' # Admin Web Port
|
- '81:81' # Admin Web Port
|
||||||
|
# - '88:88' # Public HTTP Port with proxy_protocol enabled
|
||||||
|
# - '444:444' # Public HTTPS Port with proxy_protocol enabled
|
||||||
# Add any other Stream port you want to expose
|
# Add any other Stream port you want to expose
|
||||||
# - '21:21' # FTP
|
# - '21:21' # FTP
|
||||||
environment:
|
environment:
|
||||||
|
@ -72,7 +72,7 @@
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-12 col-md-12">
|
<div class="col-sm-6 col-md-6">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="custom-switch">
|
<label class="custom-switch">
|
||||||
<input type="checkbox" class="custom-switch-input" name="allow_websocket_upgrade" value="1"<%- allow_websocket_upgrade ? ' checked' : '' %>>
|
<input type="checkbox" class="custom-switch-input" name="allow_websocket_upgrade" value="1"<%- allow_websocket_upgrade ? ' checked' : '' %>>
|
||||||
@ -81,6 +81,22 @@
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-sm-6 col-md-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="custom-switch">
|
||||||
|
<input type="checkbox" class="custom-switch-input" name="enable_proxy_protocol" value="1"<%- enable_proxy_protocol ? ' checked' : '' %>>
|
||||||
|
<span class="custom-switch-indicator"></span>
|
||||||
|
<span class="custom-switch-description"><%- i18n('proxy-hosts', 'enable-proxy-protocol') %><a href="https://docs.nginx.com/nginx/admin-guide/load-balancer/using-proxy-protocol/#introduction" target="_blank"><i class="fe fe-help-circle"></i></a></span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-sm-12 col-md-12">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label"><%- i18n('proxy-hosts', 'load-balancer-ip') %> <a href="https://docs.nginx.com/nginx/admin-guide/load-balancer/using-proxy-protocol/#changing-the-load-balancers-ip-address-to-the-client-ip-address" target="_blank"><i class="fe fe-help-circle"></i></a></label>
|
||||||
|
<input type="text" name="load_balancer_ip" class="form-control text-monospace" placeholder="" value="<%- load_balancer_ip %>" autocomplete="off" maxlength="255" <%- enable_proxy_protocol ? '' : ' disabled' %>>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="col-sm-12 col-md-12">
|
<div class="col-sm-12 col-md-12">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
@ -43,6 +43,8 @@ module.exports = Mn.View.extend({
|
|||||||
dns_provider_credentials: 'textarea[name="meta[dns_provider_credentials]"]',
|
dns_provider_credentials: 'textarea[name="meta[dns_provider_credentials]"]',
|
||||||
propagation_seconds: 'input[name="meta[propagation_seconds]"]',
|
propagation_seconds: 'input[name="meta[propagation_seconds]"]',
|
||||||
forward_scheme: 'select[name="forward_scheme"]',
|
forward_scheme: 'select[name="forward_scheme"]',
|
||||||
|
enable_proxy_protocol: 'input[name="enable_proxy_protocol"]',
|
||||||
|
load_balancer_ip: 'input[name="load_balancer_ip"]',
|
||||||
letsencrypt: '.letsencrypt'
|
letsencrypt: '.letsencrypt'
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -51,6 +53,13 @@ module.exports = Mn.View.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
events: {
|
events: {
|
||||||
|
'change @ui.enable_proxy_protocol': function () {
|
||||||
|
let checked = this.ui.enable_proxy_protocol.prop('checked');
|
||||||
|
this.ui.load_balancer_ip
|
||||||
|
.prop('disabled', !checked)
|
||||||
|
.parents('.form-group')
|
||||||
|
.css('opacity', checked ? 1 : 0.5);
|
||||||
|
},
|
||||||
'change @ui.certificate_select': function () {
|
'change @ui.certificate_select': function () {
|
||||||
let id = this.ui.certificate_select.val();
|
let id = this.ui.certificate_select.val();
|
||||||
if (id === 'new') {
|
if (id === 'new') {
|
||||||
@ -163,6 +172,7 @@ module.exports = Mn.View.extend({
|
|||||||
data.block_exploits = !!data.block_exploits;
|
data.block_exploits = !!data.block_exploits;
|
||||||
data.caching_enabled = !!data.caching_enabled;
|
data.caching_enabled = !!data.caching_enabled;
|
||||||
data.allow_websocket_upgrade = !!data.allow_websocket_upgrade;
|
data.allow_websocket_upgrade = !!data.allow_websocket_upgrade;
|
||||||
|
data.enable_proxy_protocol = !!data.enable_proxy_protocol;
|
||||||
data.http2_support = !!data.http2_support;
|
data.http2_support = !!data.http2_support;
|
||||||
data.hsts_enabled = !!data.hsts_enabled;
|
data.hsts_enabled = !!data.hsts_enabled;
|
||||||
data.hsts_subdomains = !!data.hsts_subdomains;
|
data.hsts_subdomains = !!data.hsts_subdomains;
|
||||||
@ -264,6 +274,7 @@ module.exports = Mn.View.extend({
|
|||||||
onRender: function () {
|
onRender: function () {
|
||||||
let view = this;
|
let view = this;
|
||||||
|
|
||||||
|
this.ui.enable_proxy_protocol.trigger('change');
|
||||||
this.ui.ssl_forced.trigger('change');
|
this.ui.ssl_forced.trigger('change');
|
||||||
this.ui.hsts_enabled.trigger('change');
|
this.ui.hsts_enabled.trigger('change');
|
||||||
|
|
||||||
|
@ -42,6 +42,22 @@
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-sm-6 col-md-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="custom-switch">
|
||||||
|
<input type="checkbox" class="custom-switch-input" name="enable_proxy_protocol" value="1"<%- enable_proxy_protocol ? ' checked' : '' %>>
|
||||||
|
<span class="custom-switch-indicator"></span>
|
||||||
|
<span class="custom-switch-description"><%- i18n('streams', 'enable-proxy-protocol') %><a href="https://docs.nginx.com/nginx/admin-guide/load-balancer/using-proxy-protocol/#introduction" target="_blank"><i class="fe fe-help-circle"></i></a></span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-sm-12 col-md-12">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label"><%- i18n('streams', 'load-balancer-ip') %><a href="https://docs.nginx.com/nginx/admin-guide/load-balancer/using-proxy-protocol/#changing-the-load-balancers-ip-address-to-the-client-ip-address" target="_blank"><i class="fe fe-help-circle"></i></a></label>
|
||||||
|
<input type="text" name="load_balancer_ip" class="form-control text-monospace" placeholder="" value="<%- load_balancer_ip %>" autocomplete="off" maxlength="255" <%- enable_proxy_protocol ? '' : ' disabled' %>>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="col-sm-12 col-md-12">
|
<div class="col-sm-12 col-md-12">
|
||||||
<div class="forward-type-error invalid-feedback"><%- i18n('streams', 'forward-type-error') %></div>
|
<div class="forward-type-error invalid-feedback"><%- i18n('streams', 'forward-type-error') %></div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -14,6 +14,8 @@ module.exports = Mn.View.extend({
|
|||||||
ui: {
|
ui: {
|
||||||
form: 'form',
|
form: 'form',
|
||||||
forwarding_host: 'input[name="forwarding_host"]',
|
forwarding_host: 'input[name="forwarding_host"]',
|
||||||
|
enable_proxy_protocol: 'input[name="enable_proxy_protocol"]',
|
||||||
|
load_balancer_ip: 'input[name="load_balancer_ip"]',
|
||||||
type_error: '.forward-type-error',
|
type_error: '.forward-type-error',
|
||||||
buttons: '.modal-footer button',
|
buttons: '.modal-footer button',
|
||||||
switches: '.custom-switch-input',
|
switches: '.custom-switch-input',
|
||||||
@ -22,6 +24,13 @@ module.exports = Mn.View.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
events: {
|
events: {
|
||||||
|
'change @ui.enable_proxy_protocol': function () {
|
||||||
|
let checked = this.ui.enable_proxy_protocol.prop('checked');
|
||||||
|
this.ui.load_balancer_ip
|
||||||
|
.prop('disabled', !checked)
|
||||||
|
.parents('.form-group')
|
||||||
|
.css('opacity', checked ? 1 : 0.5);
|
||||||
|
},
|
||||||
'change @ui.switches': function () {
|
'change @ui.switches': function () {
|
||||||
this.ui.type_error.hide();
|
this.ui.type_error.hide();
|
||||||
},
|
},
|
||||||
@ -47,6 +56,7 @@ module.exports = Mn.View.extend({
|
|||||||
data.forwarding_port = parseInt(data.forwarding_port, 10);
|
data.forwarding_port = parseInt(data.forwarding_port, 10);
|
||||||
data.tcp_forwarding = !!data.tcp_forwarding;
|
data.tcp_forwarding = !!data.tcp_forwarding;
|
||||||
data.udp_forwarding = !!data.udp_forwarding;
|
data.udp_forwarding = !!data.udp_forwarding;
|
||||||
|
data.enable_proxy_protocol = !!data.enable_proxy_protocol;
|
||||||
|
|
||||||
let method = App.Api.Nginx.Streams.create;
|
let method = App.Api.Nginx.Streams.create;
|
||||||
let is_new = true;
|
let is_new = true;
|
||||||
@ -76,6 +86,10 @@ module.exports = Mn.View.extend({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onRender: function () {
|
||||||
|
this.ui.enable_proxy_protocol.trigger('change');
|
||||||
|
},
|
||||||
|
|
||||||
initialize: function (options) {
|
initialize: function (options) {
|
||||||
if (typeof options.model === 'undefined' || !options.model) {
|
if (typeof options.model === 'undefined' || !options.model) {
|
||||||
this.model = new StreamModel.Model();
|
this.model = new StreamModel.Model();
|
||||||
|
@ -131,6 +131,8 @@
|
|||||||
"help-content": "A Proxy Host is the incoming endpoint for a web service that you want to forward.\nIt provides optional SSL termination for your service that might not have SSL support built in.\nProxy Hosts are the most common use for the Nginx Proxy Manager.",
|
"help-content": "A Proxy Host is the incoming endpoint for a web service that you want to forward.\nIt provides optional SSL termination for your service that might not have SSL support built in.\nProxy Hosts are the most common use for the Nginx Proxy Manager.",
|
||||||
"access-list": "Access List",
|
"access-list": "Access List",
|
||||||
"allow-websocket-upgrade": "Websockets Support",
|
"allow-websocket-upgrade": "Websockets Support",
|
||||||
|
"enable-proxy-protocol": "Enable Proxy Protocol",
|
||||||
|
"load-balancer-ip": "Load balancer or TCP proxy IP / CIDR range",
|
||||||
"ignore-invalid-upstream-ssl": "Ignore Invalid SSL",
|
"ignore-invalid-upstream-ssl": "Ignore Invalid SSL",
|
||||||
"custom-forward-host-help": "Add a path for sub-folder forwarding.\nExample: 203.0.113.25/path/",
|
"custom-forward-host-help": "Add a path for sub-folder forwarding.\nExample: 203.0.113.25/path/",
|
||||||
"search": "Search Host…"
|
"search": "Search Host…"
|
||||||
@ -175,6 +177,8 @@
|
|||||||
"protocol": "Protocol",
|
"protocol": "Protocol",
|
||||||
"tcp": "TCP",
|
"tcp": "TCP",
|
||||||
"udp": "UDP",
|
"udp": "UDP",
|
||||||
|
"enable-proxy-protocol": "Enable Proxy Protocol",
|
||||||
|
"load-balancer-ip": "Load balancer or TCP proxy IP / CIDR range",
|
||||||
"delete": "Delete Stream",
|
"delete": "Delete Stream",
|
||||||
"delete-confirm": "Are you sure you want to delete this Stream?",
|
"delete-confirm": "Are you sure you want to delete this Stream?",
|
||||||
"help-title": "What is a Stream?",
|
"help-title": "What is a Stream?",
|
||||||
|
@ -19,6 +19,8 @@ const model = Backbone.Model.extend({
|
|||||||
hsts_subdomains: false,
|
hsts_subdomains: false,
|
||||||
caching_enabled: false,
|
caching_enabled: false,
|
||||||
allow_websocket_upgrade: false,
|
allow_websocket_upgrade: false,
|
||||||
|
enable_proxy_protocol: false,
|
||||||
|
load_balancer_ip: '',
|
||||||
block_exploits: false,
|
block_exploits: false,
|
||||||
http2_support: false,
|
http2_support: false,
|
||||||
advanced_config: '',
|
advanced_config: '',
|
||||||
|
@ -5,18 +5,20 @@ const model = Backbone.Model.extend({
|
|||||||
|
|
||||||
defaults: function () {
|
defaults: function () {
|
||||||
return {
|
return {
|
||||||
id: undefined,
|
id: undefined,
|
||||||
created_on: null,
|
created_on: null,
|
||||||
modified_on: null,
|
modified_on: null,
|
||||||
incoming_port: null,
|
incoming_port: null,
|
||||||
forwarding_host: null,
|
forwarding_host: null,
|
||||||
forwarding_port: null,
|
forwarding_port: null,
|
||||||
tcp_forwarding: true,
|
tcp_forwarding: true,
|
||||||
udp_forwarding: false,
|
udp_forwarding: false,
|
||||||
enabled: true,
|
enable_proxy_protocol: false,
|
||||||
meta: {},
|
load_balancer_ip: "",
|
||||||
|
enabled: true,
|
||||||
|
meta: {},
|
||||||
// The following are expansions:
|
// The following are expansions:
|
||||||
owner: null
|
owner: null
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -29,6 +29,8 @@ describe('Proxy Hosts endpoints', () => {
|
|||||||
block_exploits: false,
|
block_exploits: false,
|
||||||
caching_enabled: false,
|
caching_enabled: false,
|
||||||
allow_websocket_upgrade: false,
|
allow_websocket_upgrade: false,
|
||||||
|
enable_proxy_protocol: false,
|
||||||
|
load_balancer_ip: '',
|
||||||
http2_support: false,
|
http2_support: false,
|
||||||
hsts_enabled: false,
|
hsts_enabled: false,
|
||||||
hsts_subdomains: false,
|
hsts_subdomains: false,
|
||||||
|
Reference in New Issue
Block a user