From 8b2a993fb00ed567d6463eb62de001bdea05859b Mon Sep 17 00:00:00 2001 From: Jason Rothstein Date: Tue, 26 Oct 2021 21:21:39 -0500 Subject: [PATCH] Add URL Redirection for websites --- README.md | 1 + templates/Fedora/34/etc/httpd/conf.d/vhost.conf | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/README.md b/README.md index 44ba2a5..81a043b 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ Role Variables * optional dictionary elements * aliases : list of alternative FQDN for the website * proxy : URL to direct traffic for the FQDN to, e.g. http://localhost:8080 + * redirect : Where should we send traffic? ~~~ lets_encrypt_admin: 'acme@example.com' diff --git a/templates/Fedora/34/etc/httpd/conf.d/vhost.conf b/templates/Fedora/34/etc/httpd/conf.d/vhost.conf index 47f5f86..573e7ef 100644 --- a/templates/Fedora/34/etc/httpd/conf.d/vhost.conf +++ b/templates/Fedora/34/etc/httpd/conf.d/vhost.conf @@ -27,6 +27,9 @@ MDStoreDir md {% endif %} ServerAdmin webmaster@{{ item.fqdn }} DocumentRoot /srv/http/{{ item.fqdn }} +{% if item.redirect is defined %} + Redirect temp {{ item.redirect }} +{% endif %} MDomain {{ item.fqdn }} @@ -54,6 +57,9 @@ MDomain {{ item.fqdn }} ProxyPass "/" "{{ item.proxy }}" ProxyPassReverse "/" "{{ item.proxy }}" ProxyTimeout 300 +{% endif %} +{% if item.redirect is defined %} + Redirect temp {{ item.redirect }} {% endif %} Require all denied