Support » Localhost Installs » Problem with CRON

  • We use WordPress for our Intranet site.

    We use the NADI Plug-in and have it set to block anonymous access and we have Windows Authentication enabled.

    with NADI we get to log in automatically when we hit the site.

    What I have noticed is that CRON is not running, I ran a Site Health Check and these are 2 problems that relate to CRON that caught my attention.

    The Rest API encountered an unexpected result
    The REST API is one way WordPress, and other applications, communicate with the server. One example is the block editor screen, which relies on this to display, and save, your posts and pages.

    The REST API call gave the following unexpected result: (401) <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>IIS 8.5 Detailed Error - 401.2 - Unauthorized</title>

    Your site could not complete a loopback request
    Loopback requests are used to run scheduled events, and are also used by the built-in editors for themes and plugins to verify code stability.

    The loopback request returned an unexpected http status code, 401, it was not possible to determine if this will prevent features from working as expected.

    I’ve tried googling this issue and none of the suggestions posted match my situation, even though I tried each of those suggestions and none of them have worked, and I think it’s because none of those people are blocking anonymous access and using Windows Authentication.

    Any ideas on what I can do?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Dion

    (@diondesigns)

    Since your question is plugin-related and not really WordPress-related, you should probably post your support request in the plugin’s support area:

    https://wordpress.org/support/plugin/next-active-directory-integration/#new-post

    Thread Starter grojas1980

    (@grojas1980)

    While I would agree if it was the plug-in that was causing the problem, I’ve deactivated ALL plugins and still get the same result.

    Dion

    (@diondesigns)

    Your original post never mentioned that you tried deactivating all plugins. 🙂

    If you have deactivated the plugin that blocks anonymous access and you still experience the HTTP401 problem, then I suggest looking at your IIS settings.

    Thread Starter grojas1980

    (@grojas1980)

    Update: I was able to get CRON running by allowing Anonymous access however, in doing so makes the NADI plug-in not work at all.

    So now, the question is. How can I get CRON working using Windows Authentication? I have created a local admin account, but I don’t know how to tell WP to use it for CRON.

    Dion

    (@diondesigns)

    Is there a way to whitelist HTTP access from the “loopback” IP address? That would seem to solve the problem.

    Otherwise, you may want to try running WP_CRON as a system task via Task Manager. The task would need to use an application such as curl and run every 15 minutes. Here’s where to get the Windows version of curl:

    https://curl.se/windows/

    Will this work for you? I have no idea, but it’s worth trying if nothing else works.

    I still think you should contact the authors of the active directory plugin; I’m sure they have encountered issues such as yours and would hopefully know how to deal with them.

    Thread Starter grojas1980

    (@grojas1980)

    I don’t think it’s being “blocked” it seems that it requires an authenticated user which is why I created a local account but I don’t know how to tell WP to use it.

    I will post in the NADI support page and see what I get.

    in the meantime, what I have done is a schedule task that allows anonymous access from midnight to 5am. (enough time for CRON to do its thing)

    Dion

    (@diondesigns)

    Well…there is an option that may work. You could set up a task in task manager that calls PHP directly to run the wp-cron.php script. That task would run as whatever user you specify in the task settings.

    This method is usually not recommended for WordPress because some plugin/theme WP_CRON tasks (stupidly) check for $_SERVER variables that don’t exist when PHP is run as a system or command-line application. Those WP_CRON tasks would either fail or produce undefined results. (WordPress is the only major PHP application that allows cron-related tasks to require HTTP requests to run correctly.)

    Thread Starter grojas1980

    (@grojas1980)

    so I found this link based on your idea:
    https://developer.wordpress.org/plugins/cron/hooking-wp-cron-into-the-system-task-scheduler/

    it doesn’t mention anything about setting up variables. I setup a task exactly how it says, I navigate to the wp-cron.php and it doesn’t throw any errors.

    I will monitor any results on it and see if I can come up with alternatives.

Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.