XMLHTTPRequest cannot load URL_HERE due to access control checks

Yes, @viktor mentioned this a few replies ago.
All seems fine on that end, and the same settings (.htaccess) on a different VPS with CP work fine.

But yes, I did find a few posts about that. Wholly unfamiliar with CORS and what that’s supposed to do and stuff though.
These directives look a bit different - I’ll give it a read, maybe I’ll learn something.

Still, to my mind, these tweaks shouldn’t be nessesary to save a post when everything else works fine.
Especially since saving anything also worked fine a few weeks ago. I made the site after-all :wink:

Here is something new… I can save pages and products, but not posts.

:expressionless::man_shrugging:

I did some more testing.

If I click save on a page it does it instantly. Same for a Classic Commerce product.
Of-course as an automatism I picked the top (newest) post to save and resave. And that does NOT work.

However, other (older) and new posts, also save.

So ONE post does not save. Fine, idiosyncrasy of the browser right?

I copy the contents, which is just a bunch of text and a shortcode.
Put it in a new post, delete the original. And now the new post doesn’t work.

I’ve tried this in Safari and Firefox.

Firefox is a bit more informative. I did find out that if I let it run for a while that after 5 seconds the post does save through load-scripts.php invoking admin-ajax. Fine. But the response is broken. If I leave it running it tries 3 times 15 seconds apart according to Firefox.

Then It fails on a internal server error.

Which shows this:

[09-Jul-2022 00:03:02 UTC] PHP Fatal error: Maximum execution time of 30 seconds exceeded in /path/to/domains/mototravel.net/wp-includes/cache.php on line 536

I don’t use any caching on the site, no plugins. This is the built-in object cache.

stumped

During this road of discovery I did figure out that ENABLE_CACHE in wp-config.php doesn’t work anymore aparently. So I removed that. I also found a thing that caches into APCu, which I added.
Seems to work - No errors, but that one f*cking post still won’t safe.

Oh, and yes, I did delete all history and cached data from Firefox during all this too. No change.

You can’t make this up really…

If it’s affecting posts but not pages, that makes me think permalinks might be the issue. Which sort are you using? Try re-saving them.

Custom: /%post_id%/%postname%/

I don’t want the date in the url really, so Google can’t ‘date’ the content based on it.

I doubt that’s the issue, then, though I don’t understand why you don’t just use postname

The id makes it so that the url is unique - So posts with the same name can happen.
Not sure if that’s really necessary yet…

It’s not necessary, as CP will just add -2 (or -3, or whatever) to the URL if that happens. On news sites, lots of posts have the same title. It’s not an issue at all.

Hmm - Never thought of that.
But, it doesn’t solve the issue.

Logically it’s not a server issue nor a CP issue as the same code works for other posts/pages to save and respond.
Other than perhaps a stupid firewall or some adaptive policy thing for security. But I can’t find such a thing.
Several browsers with or without cached pages doing this also (mostly) rule out a browser issue…

And it makes less sense now than this morning :frowning:

I think you have to do the disable plugins trick and see what happens then. As you site’s live, ideally you’d want to do this on a staging or localhost site. I’d start with the SSL plugin.

I’ve tried all that today. Also dug through the database, meta data, stuff like that looking for weird stuff.
Nothing.
I also don’t really have the patience/energy to continue looking for now. Maybe one day I’ll figure it out… Stupid internet… :expressionless:

Thanks for everyone their input and thoughtful responses. If I learn something new I’ll update the topic.

@timkaye I did change the permalinks as you suggested, looks a lot cleaner :partying_face:

1 Like

The saving issue is still present and after staring at CORS and similar stuff for hours, trying many variations of the same I found the following:

EVERY post that has an image in it that links to said image that is hosted on my own site will NOT save.
So every post that has something like this:

<a href="http://mototravel.net/wp-content/uploads/2022/10/bicol-zigzag-road.jpg"><img src="https://mototravel.net/wp-content/uploads/2022/10/bicol-zigzag-road-960x640.jpg" alt="Bicol Zigzag road" width="960" height="640" class="aligncenter size-large wp-image-2004" /></a>

Will not save and fail on a permissions error.

If I change or remove the link bit, say enter a different domain, or just the primary domain without the folders and file name, it works.

I then tried loading each bit on it’s own:
https://mototravel.net/ - WORKS
https://mototravel.net/wp-content/ - WORKS
https://mototravel.net/wp-content/uploads/ - DOESN’t WORK
https://mototravel.net/wp-content/uploads/2022/ - DOESN’t WORK
https://mototravel.net/wp-content/uploads/2022/10/ - DOESN’t WORK
https://mototravel.net/wp-content/uploads/2022/10/bicol-zigzag-road.jpg - WORKS

WHY? I have no idea…

The 403 page you see on the non working urls is a custom redirect I made for other stuff, protecting the login pages and such. I’m not sure how it applies to /uploads/ I never made that, nor can I find where it comes from - Perhaps a server directive?

BUT…

I have this same behavior on my other website (ajdg.solutions) and it works fine there. Posts with image save just fine on ajdg.solutions. See for yourself:
https://ajdg.solutions/
https://ajdg.solutions/wp-content/
https://ajdg.solutions/wp-content/uploads/
https://ajdg.solutions/wp-content/uploads/2022/

So, probably not a CORS issue after-all, but I’m equally stumped and frustrated still.

Thoughts?

Several hours more… I finally succumbed to switching themes and plugins.
Turned everything off - Default theme, no plugins, no htaccess… And it worked fine.

Turns out that the plugin “Lightswipe Masonry” (Some gallery thing) caused a conflict with galleries or something when saving posts - Because why would it…

Didn’t even look at the code to figure it out - Immediately deleted it after confirming the issue came back when the plugin was active and now the site seems fine.
Wtf!

1 Like

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