Skip to main content

ajax call from within plugin forbidden

Comments

8 comments

  • cPRex Jurassic Moderator
    Hey there! If you do run the app registration command, what output do you receive? /usr/local/cpanel/bin/register_appconfig ./example.conf
    If that works correctly, you should get confirmation that the app was registered and data will be written to the /var/cpanel/apps/ directory automatically. Can you confirm that portion is working well?
    0
  • jimlongo
    Thank you. I think I may have abandoned the AJAX call, but in the spirit of helping someone else. My install script runs $~ /usr/local/cpanel/bin/register_appconfig InstallFiles/xyz-WHM-Plugin.conf $~ xyz-WHM-Plugin registered
    But when I run your suggested check I get $~ /usr/local/cpanel/bin/register_appconfig ./xyz-WHM-Plugin.conf $~ The 'conf_file' must be readable and a plain file.
    $~ ll /var/cpanel/apps/ total 16 -rw------- 1 root root 586 Dec 4 2017 cmc.conf -rw------- 1 root root 644 Nov 11 11:32 csf.conf -rw------- 1 root root 644 Nov 12 03:31 imunify-antivirus.conf -rw------- 1 root root 300 Dec 10 10:08 xyz-WHM-Plugin.conf
    0
  • cPRex Jurassic Moderator
    Just for fun, could you try with the full path like this? I've seen that cause issues in the past: /usr/local/cpanel/bin/register_appconfig /var/cpanel/apps/youraddon.conf
    0
  • jimlongo
    Yes, thanks. $~ /usr/local/cpanel/bin/register_appconfig /var/cpanel/apps/xyz-WHM-Plugin.conf xyz-WHM-Plugin registered
    0
  • cPRex Jurassic Moderator
    After doing that, does that get things working better for you or are there still issues?
    0
  • jimlongo
    Well unfortunately as I said i've abandoned the hope of using an AJAX call, and instead just used a form submit with a page refresh. But this was always the case, the plugin was always registered, so i'm just confused why I was getting the original 403 error when trying to do an AJAX call. Can you not do AJAX calls inside a registered app?
    0
  • cPRex Jurassic Moderator
    I don't see why you *wouldn't* be able to as our own uapi does use those calls, but I don't see anything in our documentation specifically about ajax related to appconfig. If you could put in a ticket and provide some code examples we may be able to get you some additional details.
    0
  • gnusys
    Please add all the URL's in the conf file for the app. include the target script the Ajax call is using too here url1=/cgi/xyz/abc.php url2=/cgi/xyz/bcd.php etc Ajax calls do work on the WHM plugin as I have used it in multiple places on a WHM plugin.I can confirm that
    0

Please sign in to leave a comment.