@JJ-Fullmer said in HTTPS Redirect Web GUI:
https redirect
I had this issue, but wanted to add to the Copilot answer that works on RHEL 8.10 running the latest Apache and FOG 1.5.10.1634 (this assumes you installed FOG with NO HTTPS option, in other words HTTPS disabled by default):
To redirect all HTTP requests on port 80 to HTTPS on port 443 using your provided certificate and key, you can use the following configuration:
Create a new configuration file in the /etc/httpd/conf.d/ directory, for example, redirect.conf:
<VirtualHost *:80>
ServerName ip.of.fog.server
ServerAlias hostnameOfFogServer
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301,L]
</VirtualHost>
Update your SSL configuration in the /etc/httpd/conf.d/ssl.conf file to include your certificate and key:
<VirtualHost *:443>
ServerName ip.of.fog.server
ServerAlias hostnameOfFogServer
DocumentRoot /var/www/html/
SSLEngine on
SSLCertificateFile /opt/fog/ssl/UNIQUE-FOR-ME/MYCERT.cer
SSLCertificateKeyFile /opt/fog/ssl/UNIQUE-FOR-ME/MYCERT.key
<Directory /var/www/html/fog/>
DirectoryIndex index.php index.html index.htm
AllowOverride All
Require all granted
</Directory>
<FilesMatch "\.php$">
SetHandler "proxy:fcgi://127.0.0.1:9000/"
</FilesMatch>
RewriteEngine On
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
RewriteRule .* - [F]
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-d
RewriteRule ^/fog/(.*)$ /fog/api/index.php [QSA,L]
</VirtualHost>
Restart Apache to apply the changes:
sudo systemctl restart httpd
This configuration will redirect all HTTP requests to HTTPS and use the provided certificate and key for SSL. Make sure to replace ip.of.fog.server and hostnameOfFogServer with your actual server IP and hostname.
Lastly, When enrolling a cert I used the FQDN and plain hostname as a “Subject Alternative Name”. For my company, this means internal use only (.pvt). This takes care of both redirects (prob could have also talked to the DNS team to redirect the hostname to the FQDN eg hostname.blah.pvt as well. But it’s better (and faster) in the cert if you can do it that way.