wp-json showing 403 forbidden

Hi Guys

Sohag was trying to help with this problem on Chat earlier today.

It turns out that the issue was the my localhost had been forced to httpS, and with no valid certificate the connection to wp-json was being refused.

Just thought I'd pass on the solution in case it crops up again.

I don't have a copy of the chat, or I'd provide more details, maybe Sohag can turn it into a useful ticket with the chat details.

  • Sohag Ronjon Dey
    • QA

    Hi Dan,

    Thanks for contacting us and adding the information here.

    Here are some details you provided in the chat

    wp-json being blocked since the 5.2 update
    Getting a
    Failed to load resource: the server responded with a status of 403 (Forbidden)

    Please check the screenshot

    [attachments are only viewable by logged-in members]

    To debug the issue you have
    ->disabled all the plugins
    -> activated default WordPress theme
    -> Reinstalled the WordPress
    ->deleted htaccess
    ->resaved permalinks
    ->checked file permissions and they are ok (on localhost)
    and the error was still there.

    May be for that reason I could not replicate your issue at my local dev site.

    However happy to know the it is fixed. If you describe steps how you find the issue and how you fixed it that will help other members in case any of them faces such it in future.

    Thanks again for sharing this.

    Cheers,

    Sohag

  • Dan
    • WPMU DEV Initiate

    I managed to solve this issue, but thought I’d post the solution here just in case anyone else has the same problem.

    Problem: Message when Saving / Publishing a post – Updating failed

    wp-json being blocked since the 5.2 update

    Did all the usual debugging:

    – disabled all the plugins

    – activated default WordPress theme

    – Reinstalled the WordPress

    – Downloaded and reinstalled new copy (standard and -AU versions)

    – deleted htaccess

    – resaved permalinks

    – checked file permissions and they are ok (on localhost)

    Chrome inspection Console showed: Failed to load resource: the server responded with a status of 403 (Forbidden)

    Reason: Chrome was forcing localhost (XAMPP) to use httpS

    Solution:

    1. Can just remove the S from the url

    2. Stack overflow provided:

    – In the Chrome address bar type “chrome://net-internals/#hsts”

    – At the very bottom of a page is Delete domain security policies textbox – verify that localhost is known to the browser. If it says “Not found” then this is not the answer you are looking for.

    – If it is, DELETE the localhost domain using the textbox above

    – Your site should now work using plain old HTTP

    Hopefully this will save one of you from an unproductive few hours one afternoon :slight_smile: