I have discovered (or perhaps I didn't configure properly although the documentation doesn't mention it), that a default Nagios XI R5.20 installation configured to also support HTTPS via the /etc/httpd/conf.d/ssl.conf file does not support the REST API for calls to the HTTPS URL. Calls to the HTTP URL work fine.
To resolve this, you need to put the following in /etc/httpd/conf.d/ssl.conf:
Code: Select all
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule nagiosxi/api/v1/(.*)$ /usr/local/nagiosxi/html/api/v1/index.php?request=$1 [QSA,NC,L]
</IfModule>
After restarting Apache, the REST API is now accessible via both HTTP and HTTPS. I admit that there might be a more elegant way to handle this.