HTTP to HTTPS redirect failing
HTTP to HTTPS redirect failing
I was originally running with HTTP and have followed these instructions - https://assets.nagios.com/downloads/nag ... s%20XI.pdf to make it HTTPS using a self-sign certificate. I had previously sent out some information on how to login and the URL was http://<server>/nagiosxi/ but whenever someone clicks that link it doesn't work because somewhere it is redirecting to https://<server>nagiosxi/ the https is good but I am missing the / between the server domain url and the nagiosxi. I cannot figure out where or what I need to change to correct that so http://<server>/nagiosxi/ gets redirected to https://<server>/nagiosxi/
Re: HTTP to HTTPS redirect failing
If you followed the guide the redirect should be here: /etc/httpd/conf.d/nagiosxi.conf
Re: HTTP to HTTPS redirect failing
Actually, check the redirect first, but most likely you need to go to Admin > System Config > Manage System Config and add the trailing / at the end of Program URL and/or External URL.
As an example, from this:
To:
As an example, from this:
Code: Select all
https://YOURSERVER/nagiosxiCode: Select all
https://YOURSERVER/nagiosxi/Re: HTTP to HTTPS redirect failing
I have the trailing / on the Admin > System Config > Manage System Config page.
Here is what I have for the /etc/httpd/conf.d/nagiosxi.conf
Here is what I have for the /etc/httpd/conf.d/nagiosxi.conf
Code: Select all
#NameVirtualHost *:443
<VirtualHost *:80> # Add this line
Redirect permanent / https://<nagiosserver>/ -- I also tried Redirect permanent / https://<nagiosserver>/nagiosxi and Redirect permanent / https://<nagiosserver>
<Directory "/usr/local/nagiosxi/html">
# SSLRequireSSL
Options None
AllowOverride None
Order allow,deny
Allow from all
# Order deny,allow
# Deny from all
# Allow from 127.0.0.1
# AuthName "Nagios XI"
# AuthType Basic
# AuthUserFile /usr/local/nagiosxi/etc/htpasswd.users
# Require valid-user
</Directory>
# Add this line
</VirtualHost>
<VirtualHost *:443>
SSLEngine on
SSLCertificateFile /etc/pki/tls/certs/ca.crt
SSLCertificateKeyFile /etc/pki/tls/private/ca.key
<Directory "/usr/local/nagiosxi/html">
AllowOverride All
</Directory>
</VirtualHost>
Alias /nagiosxi "/usr/local/nagiosxi/html"
Re: HTTP to HTTPS redirect failing
If you remove the redirect from that file and then edit /etc/httpd/conf/httpd.conf and put this code at the bottom:
Then restart httpd:
Does that fix the problem?
Code: Select all
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}Code: Select all
service restart httpdRe: HTTP to HTTPS redirect failing
Still taking me to https://<nagiosserver>netnagiosxi/
Code: Select all
NameVirtualHost *:443
<VirtualHost *:80> # Add this line
#Redirect permanent / https://<nagiosserver>/
<Directory "/usr/local/nagiosxi/html">
# SSLRequireSSL
Options None
AllowOverride None
Order allow,deny
Allow from all
# Order deny,allow
# Deny from all
# Allow from 127.0.0.1
# AuthName "Nagios XI"
# AuthType Basic
# AuthUserFile /usr/local/nagiosxi/etc/htpasswd.users
# Require valid-user
</Directory>
# Add this line
</VirtualHost>
<VirtualHost *:443>
SSLEngine on
SSLCertificateFile /etc/pki/tls/certs/ca.crt
SSLCertificateKeyFile /etc/pki/tls/private/ca.key
<Directory "/usr/local/nagiosxi/html">
AllowOverride All
</Directory>
</VirtualHost>
Alias /nagiosxi "/usr/local/nagiosxi/html"
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
Re: HTTP to HTTPS redirect failing
What does the link that you sent out look like? Does it have the / or not? http://<nagiosserver>/nagiosxi
Re: HTTP to HTTPS redirect failing
http://<nagiosserver>/nagiosxi/
Something during the change to https is removing the / I just can't figure out what. The link worked fine before switching to https.
Something during the change to https is removing the / I just can't figure out what. The link worked fine before switching to https.
Re: HTTP to HTTPS redirect failing
Please PM me your /etc/httpd/conf/httpd.conf and your /etc/httpd/conf.d directory so I can take a look.
Re: HTTP to HTTPS redirect failing
Files received and PM sent with modified configs.