From 07b0b932565e098f6419342ca80a61cef92fcf66 Mon Sep 17 00:00:00 2001 From: rganascim Date: Sun, 19 Feb 2023 21:54:03 -0300 Subject: [PATCH] Closes #11638: add http redirect to apache --- contrib/apache.conf | 9 +++++++++ docs/installation/5-http-server.md | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/contrib/apache.conf b/contrib/apache.conf index 1804e380d..73fd45c26 100644 --- a/contrib/apache.conf +++ b/contrib/apache.conf @@ -1,3 +1,12 @@ + + # CHANGE THIS TO YOUR SERVER'S NAME + ServerName netbox.example.com + + RewriteEngine On + RewriteCond %{HTTPS} !=on + RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L] + + ProxyPreserveHost On diff --git a/docs/installation/5-http-server.md b/docs/installation/5-http-server.md index 907964554..b81c6d84a 100644 --- a/docs/installation/5-http-server.md +++ b/docs/installation/5-http-server.md @@ -65,7 +65,7 @@ sudo cp /opt/netbox/contrib/apache.conf /etc/apache2/sites-available/netbox.conf Finally, ensure that the required Apache modules are enabled, enable the `netbox` site, and reload Apache: ```no-highlight -sudo a2enmod ssl proxy proxy_http headers +sudo a2enmod ssl proxy proxy_http headers rewrite sudo a2ensite netbox sudo systemctl restart apache2 ```