Skip to content
Snippets Groups Projects
Commit ba22f409 authored by Nico's avatar Nico
Browse files

revproxy: add redirect support

parent 8e17d127
No related branches found
No related tags found
No related merge requests found
...@@ -4,6 +4,6 @@ letsencrypt_acme_directory: "https://acme-v02.api.letsencrypt.org/directory" ...@@ -4,6 +4,6 @@ letsencrypt_acme_directory: "https://acme-v02.api.letsencrypt.org/directory"
vhosts: vhosts:
- domain: grafana.freifunk-stuttgart.de - domain: grafana.freifunk-stuttgart.de
backend: http://10.0.3.237/ backend: http://10.0.3.237/
type: https type: proxy
enabled: true enabled: true
...@@ -27,6 +27,7 @@ server { ...@@ -27,6 +27,7 @@ server {
} }
location / { location / {
{% if vhost.type == "proxy" %}
proxy_pass {{ vhost.backend }}; proxy_pass {{ vhost.backend }};
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $ip_anonymized; proxy_set_header X-Forwarded-For $ip_anonymized;
...@@ -39,6 +40,9 @@ server { ...@@ -39,6 +40,9 @@ server {
proxy_pass_header Authorization; proxy_pass_header Authorization;
proxy_read_timeout 600s; proxy_read_timeout 600s;
proxy_request_buffering off; proxy_request_buffering off;
{% elif vhost.type == "redirect" %}
return 301 {{ vhost.redirect }}$request_uri;
{% endif %}
} }
} }
...@@ -47,7 +51,11 @@ server { ...@@ -47,7 +51,11 @@ server {
server_name {{ vhost.domain}}; server_name {{ vhost.domain}};
location / { location / {
{% if vhost.type == "proxy" %}
return 301 https://{{ vhost.domain }}$request_uri; return 301 https://{{ vhost.domain }}$request_uri;
{% elif vhost.type == "redirect" %}
return 301 {{ vhost.redirect }}$request_uri;
{% endif %}
} }
# lets encrypt challenges # lets encrypt challenges
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment