API URL not found on server (FPBX15 Warm Spare Setup)

Hello,

I have two FreePBX 15 servers fully updated (modules and system updates) and I would like to create a Primary/Backup warm spare setup.

I have followed this Wiki guide: Warm Spare PBX 15+ Setup

All is OK except when I click on Get Warm Spare Token I receive the following error message:
The Requested URL /admin/api/api/token was not found on this server.

If I try and browse to http:///admin/api/api/ I get a “Not Found - The requested URL /admin/api/api/ was not found on this server.”

Looking in the directory /var/www/html/admin/api I only see api.php and no sub api folder.

Where am I going wrong?

If I run the warm spare backup job on the Primary, the backup tar is created and is successfully copied over to the second server via SSH, however, of course, the API call doesn’t fire so the backup is not restored on the destination warm spare server.

Many thanks,
Fraser.

Hi !
Go to your warm spare server and type this on the CLI:

chmod 600 /etc/asterisk/keys/api_oauth_public.key
Then retry and let us know how it goes.

Hello,

My permissions for that file are already set to 600:

[[email protected] ~]# ls -l /etc/asterisk/keys/api_oauth_public.key
-rw------- 1 asterisk asterisk 451 Jul 3 21:40 /etc/asterisk/keys/api_oauth_public.key
[[email protected] ~]# chmod 600 /etc/asterisk/keys/api_oauth_public.key
[[email protected] ~]# ls -l /etc/asterisk/keys/api_oauth_public.key
-rw------- 1 asterisk asterisk 451 Jul 3 21:40 /etc/asterisk/keys/api_oauth_public.key

Any other suggestions? It seems like its an apache issue as I’m getting 404 not found.

This is what I see in /var/log/httpd/access_log on the warm spare when I click Get Warm Spare Token:

xxx.xxx.xxx.xxx - - [06/Jul/2020:08:35:31 +0100] “POST /admin/api/api/token HTTP/1.1” 404 217 “-” “-”

It’s as if the wiki is wrong and I should be entering a different URL for the API.

Thanks
Fraser

Are you whitelisting primary IP on your warm spare server ? (Connectivity > Firewall > Networks > Add your Network or Primary IP as trusted)

Yes, the Subnet of both servers are “trusted” on both active and warm server.

I don’t believe this is firewall related as I am getting a response (404 not found) from the warm spare.

Could someone please verify what happens when they use a browser and try and browse to http://IPAddrees/admin/api/api ? What response do they get.

I’ve got to the bottom of this! Within the Apache config, I have some access restrictions preventing access to the FreePBX and FOP2 admin pages. This configuration had AllowOverride None which meant the FreePBX .htaccess were being ignore. I removed that line, restarted apache and then the api started working!

I’ve kicked off the Warm Spare Backup/Restore job on the Primary PBX and at the bottom of the log, I get the Restorestatus : Restore Done message. Although the config of the warm spare still hasn’t updated, this is a large PBX so its probably still restoring on the second box.

Thanks for help. This seems to be resolved now!

Fraser.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.