forked from NginxProxyManager/nginx-proxy-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for proxy_protocol in proxy_hosts and streams
Closes NginxProxyManager#1114 Related To NginxProxyManager#1882 Related To NginxProxyManager#3537 Related To NginxProxyManager#3618 Co-authored-by: jwklijnsma <[email protected]> Co-authored-by: SBado <[email protected]>
- Loading branch information
1 parent
ee41bb5
commit fc6a313
Showing
30 changed files
with
271 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
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('proxy_protocol_enabled').notNull().defaultTo(0); | ||
proxy_host.string('loadbalancer_address').notNull().defaultTo(''); | ||
}) | ||
.then(() => { | ||
logger.info('[' + migrate_name + '] proxy_host Table altered'); | ||
|
||
return knex.schema.table('stream', function (stream) { | ||
stream.integer('proxy_protocol_enabled').notNull().defaultTo(0); | ||
stream.string('loadbalancer_address').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('proxy_host', function (proxy_host) { | ||
proxy_host.dropColumn('proxy_protocol_enabled'); | ||
proxy_host.dropColumn('loadbalancer_address'); | ||
}) | ||
.then(function () { | ||
logger.info('[' + migrate_name + '] proxy_host Table altered'); | ||
return knex.schema.table('stream', function (stream) { | ||
stream.dropColumn('proxy_protocol_enabled'); | ||
stream.dropColumn('loadbalancer_address'); | ||
}) | ||
.then(function () { | ||
logger.info('[' + migrate_name + '] stream Table altered'); | ||
}); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,29 @@ | ||
listen 80; | ||
|
||
{% if proxy_protocol_enabled == 1 or proxy_protocol_enabled == true -%} | ||
{% assign port_number_http = "88" -%} | ||
{% assign port_number_https = "444" -%} | ||
{% assign listen_extra_args = "proxy_protocol" -%} | ||
{% else -%} | ||
{% assign port_number_http = "80" -%} | ||
{% assign port_number_https = "443" -%} | ||
{% assign listen_extra_args = "" -%} | ||
{% endif -%} | ||
|
||
listen {{ port_number_http }} {{ listen_extra_args }}; | ||
{% if ipv6 -%} | ||
listen [::]:80; | ||
listen [::]:{{ port_number_http }} {{ listen_extra_args }}; | ||
{% else -%} | ||
#listen [::]:80; | ||
{% endif %} | ||
#listen [::]:{{ port_number_http }} {{ listen_extra_args }}; | ||
{% endif -%} | ||
|
||
{% 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 -%} | ||
listen [::]:443 ssl{% if http2_support == 1 or http2_support == true %} http2{% endif %}; | ||
listen [::]:{{ port_number_https }} {{ listen_extra_args_https }}; | ||
{% else -%} | ||
#listen [::]:443; | ||
{% endif %} | ||
{% endif %} | ||
server_name {{ domain_names | join: " " }}; | ||
#listen [::]:{{ port_number_https }} {{ listen_extra_args_https }}; | ||
{% endif -%} | ||
{% endif -%} | ||
|
||
server_name {{ domain_names | join: " " }}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{% if proxy_protocol_enabled == 1 or proxy_protocol_enabled == true %} | ||
{% if loadbalancer_address != '' %} | ||
set_real_ip_from {{ loadbalancer_address }}; | ||
real_ip_header proxy_protocol; | ||
{% endif %} | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.