nginx/site: Allow using url format for multiple proxies
This commit is contained in:
parent
5f8371eb12
commit
6f12feebc3
1 changed files with 3 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
||||||
{% if proxy is defined and proxy is not string %}
|
{% if proxy is defined and proxy is not string %}
|
||||||
upstream upstream_{{ site }} {
|
upstream upstream_{{ site }} {
|
||||||
{% for item in proxy %}
|
{% for item in proxy %}
|
||||||
|
{% set item = item | regex_replace("^(https://)?([^/]*).*$", "\\2") %}
|
||||||
{% if item | regex_search(".*:[0-9]+$") %}
|
{% if item | regex_search(".*:[0-9]+$") %}
|
||||||
server {{ item }};
|
server {{ item }};
|
||||||
{% else %}
|
{% else %}
|
||||||
|
@ -35,9 +36,10 @@ server {
|
||||||
{% elif proxy is defined %}
|
{% elif proxy is defined %}
|
||||||
location / {
|
location / {
|
||||||
{% if proxy is not string %}
|
{% if proxy is not string %}
|
||||||
|
{% set path = proxy[0] | regex_replace("^(https://)?([^/]*)(.*)$", "\\3") %}
|
||||||
# https://trac.nginx.org/nginx/ticket/1307
|
# https://trac.nginx.org/nginx/ticket/1307
|
||||||
proxy_ssl_verify off;
|
proxy_ssl_verify off;
|
||||||
proxy_pass https://upstream_{{ site }};
|
proxy_pass https://upstream_{{ site }}{{ path }};
|
||||||
{% else %}
|
{% else %}
|
||||||
proxy_pass {{ proxy }};
|
proxy_pass {{ proxy }};
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
Loading…
Add table
Reference in a new issue