Allow for the definition of a singular proxy_pass on ingress_servers to simplify configuration

This commit is contained in:
Salt 2021-09-18 07:19:26 -05:00
parent b5057c4064
commit 9b79068380
2 changed files with 18 additions and 31 deletions

View File

@ -55,20 +55,14 @@
ingress_servers:
# desu.ltd
- name: desu.ltd
proxies:
- location: /
pass: http://desultd:80
proxy_pass: http://desultd:80
- name: git.desu.ltd
proxies:
- location: /
pass: http://gitea:3000
proxy_pass: http://gitea:3000
- name: nc.desu.ltd
directives:
- "add_header Strict-Transport-Security \"max-age=31536000\""
- "client_max_body_size 0"
proxies:
- location: /
pass: http://nextcloud:80
proxy_pass: http://nextcloud:80
locations:
- location: "^~ /.well-known"
contents: |
@ -81,13 +75,9 @@
directives:
- "return 301 $scheme://9iron.club$request_uri"
- name: 9iron.club
proxies:
- location: /
pass: http://9iron:80
proxy_pass: http://9iron:80
- name: srv.9iron.club
proxies:
- location: /
pass: http://srv:80
proxy_pass: http://srv:80
tags: [ web, docker, ingress ]
- hosts: web2.desu.ltd
module_defaults:
@ -125,13 +115,9 @@
vars:
ingress_servers:
- name: cowfee.moe
proxies:
- location: /
pass: http://pleroma:4000
proxy_pass: http://pleroma:4000
- name: tube.cowfee.moe
proxies:
- location: /
pass: http://peertube:9000
proxy_pass: http://peertube:9000
tags: [ web, docker, ingress ]
- hosts: web3.desu.ltd
module_defaults:
@ -169,15 +155,9 @@
vars:
ingress_servers:
- name: netbox.desu.ltd
proxies:
- location: /
pass: http://netbox:8080
proxy_pass: http://netbox:8080
- name: nagios.desu.ltd
proxies:
- location: /
pass: http://nagios:80
proxy_pass: http://nagios:80
- name: movie.desu.ltd
proxies:
- location: /
pass: http://movienight:8089
proxy_pass: http://movienight:8089
tags: [ web, docker, ingress ]

View File

@ -22,7 +22,14 @@ server {
{% endfor %}
{% endif %}
{% if server.proxies is defined %}
{% if server.proxy_pass is defined %}
# Singular proxy_pass
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass {{ server.proxy_pass }};
}
{% elif server.proxies is defined %}
# Proxy locations
{% for proxy in server.proxies %}
location {{ proxy.location }} {