Site trying to re-direct to InfinityFree 404 page causing saving errors

After many hours of digging and checking console logs, I figured out the reason that I get the error “You are probably offline” when trying to save any changes specifically in the widgets section.

I get this error in console:

Access to fetch at ‘’ (redirected from ‘https://website/wp-json/batch/v1?_locale=user’) from origin ‘https://website’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.

I then figured out that when your page tries to call InfinityFree’s 404 page, it uses a AJAX request to do so. Since you are not allowed to use AJAX requests outide of your own sub-domain, on free hosting, it returns back a error. The important part of the error is this one:

No ‘Access-Control-Allow-Origin’ header is present on the requested resource

According to the admin, that error is thrown when you try and make a AJAX call outside of your own sub-domain due to free hosting. They said the fix is to stop the 404 page from being called, normally by removing links.

This is where my issue lies. I have not a single link on my site, nor a single post. Its a fresh site. Therefore, something to do with saving any changes in the widgets causes a 404 request. How do I stop that?

I have tried a clean install on a new account, no plugins, default theme and I even used Site Health plugin and turned on troubleshoot mode which strips everything down to default and still the same error.

Note: Page edits work perfectly fine. As does everything else on the site.

I have finally figured it all out.

On a free hosting plan, you are unable to make widget calls through the Appearance menu. Meaning, you can not take the below route to make widget changes:

Appearance > Widgets

You have to do it through the Customize menu, which edits the widgets whilst your on your homepage looking at them. Meaning, you have to go through this route:

Appearance > Customize > Widgets

Glad you figured this out!

1 Like

Thank you!

It was quite a journey, and it taught me a lot about how WordPress, certificates and https worked.

You helped me rule out a large portion of solutions which helped a lot!


Please note that none of the AJAX errors are “because of free hosting.” Those errors would happen on any website anywhere with CORS improperly configured on the destination website.


I am using the default configuration an have not touched CORS, therefore it still sounds like a bug on the hosters (InfinityFree) side.

The reason I said it was because of free hosting, was due to the limitation of internal AJAX calls only. Therefore, external AJAX calls (such as ones to InfinityFree 404 page) would cause an error to appear and it did. The exact same error they said would appear if you attempted this.

I would still be very interested in how to fix that CORS issue on the widget tab though!

It’s not a bug. The CORS error is not pretty, but it is working as intended.

You’re partially right regarding the CORS limitation of free hosting. But these free hosting limitations involve connecting to your site from other websites. There is nothing on our end stopping you from accessing AJAX URLs on other websites.

That is, assuming those external websites have the required CORS settings to allow sites to connect to them. Which our error pages do not, because there is no reason to, as you wouldn’t be able to see the content anyways.

I guess we could allow CORS and return a meaningful error message and status code depending on the inbound request. But doing so will only help to prevent confusion and make people believe that it’s a CORS issue. Because it’s not a CORS issue, the issue is that the URL you’re calling on your website is returning an error status code.


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