WooCommerce Setup Wizard Infinite Loop with 500 REST API Error & JS Errors

  • Unknown's avatar

    Subject: WooCommerce Setup Wizard Infinite Loop with 500 REST API Error & JS Errors on II
    I’m encountering an infinite loading issue with the WooCommerce Setup Wizard, specifically when clicking plugin category or home. While I’ve successfully resolved initial Content Security Policy (CSP) errors, two problems remain:

    1. A ‘500 REST API error’ on the /index.php?rest_route=%2Fwc-admin%2Fonboarding%2Fprofile&_locale=user endpoint.
    2. A JavaScript error: Cannot read properties of undefined (reading 'title').

    I’ve taken several troubleshooting steps, including:

    • Performing a conflict test on a fresh WordPress installation with no plugins and a base theme (Astra).
    • Increasing all inputs, memory, storage, and PHP max_input_vars.
    • Verifying WordPress and Site URLs are identical and use HTTPS in Settings > General.
    • Checking browser console for errors (which revealed the 500 REST API and JS errors).
    • Reviewing Cloudflare configuration, ensuring SSL/TLS is ‘Full (strict)’, and temporarily pausing Cloudflare (which did not resolve the core issue).
    • Confirming the URL Rewrite module is configured on my Windows VM with IIS.
    • I also noted an earlier Action Scheduler migration_hook failure with “no callbacks are registered,” though I am unsure if it directly relates to the current infinite loading.

    My environment runs on a Windows VM with IIS/PHP/SQL, routed through Cloudflare (with force HTTPS enabled).

    Full system status report: (added to pastebin link below).
    https://pastebin.com/538cQsJ7

  • Unknown's avatar

    We addressed three major categories of errors to get our WooCommerce setup wizard working on the IIS (Windows) server:

    1. ⚙️ Web Server Configuration Crash (500 Error)

    The initial problem was that our site would throw a 500 Internal Server Error immediately upon uploading a minimal web.config file.

    • The Problem: Our server had an extensive configuration inherited from the master settings (like Machine.config). When you uploaded a minimal file, the inherited settings kicked in, often leading to duplicate handler entries or configuration conflicts, which crash the web server.
    • The Fix: We restored the necessary <clear /> tag inside the <handlers> section. This explicitly tells the server to wipe out all inherited handler settings before applying the new one, ensuring a clean, conflict-free configuration environment.

    2. 🔌 WordPress REST API Routing Failure (404/405 Errors)

    Once the server was stable, the WooCommerce setup wizard was still broken, displaying a lot of 404 Not Found errors for URLs like /wp-json/... and a 405 Method Not Allowed error.

    • The 404 Fix (URL Rewrite): WordPress uses “pretty permalinks,” which rely on a URL Rewrite module to route requests that don’t point to actual files (like /wp-json/) back to the core index.php file. We added the standard WordPress <rewrite> rules to the new web.config, allowing the REST API calls to finally reach WordPress.
    • The 405 Fix (HTTP Verbs): The 405 Method Not Allowed error occurred because the default PHP handler only allowed GETHEAD, and POST methods. The REST API often uses PUT or DELETE to update settings.1 We updated the PHP handler in the web.config to allow all verbs (verb="*") which resolved this blockage.

    3. 🛡️ Content Security Policy (CSP) Violation

    The final step was addressing the warning that appeared once the wizard loaded:

    • The Problem: Our strict Content Security Policy (CSP) was blocking a script required by WordPress stats (https://stats.wp.com/w.js).
    • The Fix: We updated the script-src whitelist inside the <httpProtocol> $rightarrow$ <customHeaders> section of our web.config to explicitly include https://stats.wp.com, eliminating the violation.

    In summary, the key to success was moving from a completely broken configuration environment to a clean, stable one, and then explicitly configuring IIS to properly support all the underlying functions (Permalinks, REST API verbs, and CSP) required by WordPress and WooCommerce.

  • Hi, @officertruenorth. It seems like you already fixed the issue, but heads-up that since your question is specific to WooCommerce on a self-hosted WordPress.org site, we generally recommend posting on the WooCommerce support forum for help.

    We can only help with WordPress.com sites on this forum, and even though I see you mentioned stats.wp.com, the impression I have is that this issue was related to our ISS environment.

    You can learn more about the differences between WordPress.com and WordPress.org here:

    WP
    WordPress.com vs. WordPress.org
    6 min read
    WordPress powers millions of websites, from bloggers and small businesses to massive news sites and companies. This guide will help you to understand the difference between WordPress.com and WordPress.org, and which might be the best fit for your website. In this guideVideo overviewOverview of differencesComparison of featuresOverview of WordPress.comOverview of WordPress.orgFr

    Let me know if you have further questions.

Log in or create an account to reply