We just upgraded to 5.2.8 and were using the older form of the REST API. We can't get it working in the new version. If we do this:
https://nagiosxi-pgh01.eagleaccess.com/ ... y=p2pmjepq
We get this:
Status Code: 404 Not Found
Connection: close
Content-Length: 325
Content-Type: text/html; charset=iso-8859-1
Date: Mon, 18 Jul 2016 20:31:58 GMT
Server: Apache/2.2.15 (Red Hat)
If this:
https://nagiosxi-pgh01.eagleaccess.com/nagiosxi/api/v1/
{"error":"No API Key provided"}
We also added this to the end of our /etc/httpd/conf.d/ssl.conf
<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>
Any help is appreciated.
Thx.
-D
REST API After upgrade to 5.2.8
Re: REST API After upgrade to 5.2.8
I saw this happening on a test system. The ssl_error_log was showing -
I just tested this, and had to add exactly what you posted right before the </VirtualHost> tag.
For example -
Then, run service httpd restart and try once again. It should be working.
If not, please post your /var/log/httpd/ssl_error_log file, and also your ssl.conf file.
Code: Select all
[Mon Jul 18 15:58:55 2016] [error] [client x] File does not exist: /usr/local/nagiosxi/html/api/v1/system, referer: https://x/nagiosxi/help/api.php
For example -
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?req$
</IfModule>
</VirtualHost>
If not, please post your /var/log/httpd/ssl_error_log file, and also your ssl.conf file.
Former Nagios Employee
Re: REST API After upgrade to 5.2.8
For the record, I updated the SSL documentation. You can use the following one liner to make the change to your ssl.conf if it does not already exist. (which it sounds like you already have, this is just for reference)
Code: Select all
sed -i -e '/<\/VirtualHost>/i\<IfModule mod_rewrite.c>' -e '/<\/VirtualHost>/i\RewriteEngine On' -e '/<\/VirtualHost>/i\RewriteCond %{REQUEST_FILENAME} !-f' -e '/<\/VirtualHost>/i\RewriteCond %{REQUEST_FILENAME} !-d' -e '/<\/VirtualHost>/i\RewriteRule nagiosxi/api/v1/(.*)$ /usr/local/nagiosxi/html/api/v1/index.php?request=$1 [QSA,NC,L]' -e '/<\/VirtualHost>/i\</IfModule>' /etc/httpd/conf.d/ssl.conf
Former Nagios Employee
-
powderbuck
- Posts: 4
- Joined: Tue Oct 28, 2014 4:35 pm
Re: REST API After upgrade to 5.2.8
No change, even after moving it inside the virtualhost block.
Upon closer inspection, there was a duplicate SSL/443 setup in nagiosxi.conf, I moved any unique settings from that into ssl.conf and restarted. Looks good now.
Thanks.
Upon closer inspection, there was a duplicate SSL/443 setup in nagiosxi.conf, I moved any unique settings from that into ssl.conf and restarted. Looks good now.
Thanks.
Re: REST API After upgrade to 5.2.8
Thanks for sharing your solution! Is it alright if we lock this thread and mark the issue as resolved?
Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/