YOU ARE THE BEST
thank you very muck @orballo
Sorry for that @orballo
but the error appears again
this time I noticed something weird
the rejected request is missing many headers
valid request :
invalid request:
I donāt know if this has any significance ??
Do the posts and pages from before work now? Or is it still the same error?
If not, what are you trying to call? Can you post here the failing request?
if you are on page http://localhost:3000/
and then clicked on a link with href="/about-us/"
the error appears
the request is
http://wp-local.com/wp-json/wp/v2/pages/?_embed=true&slug=about-us
I run into a similar problem and I realised it was because I was working on localhost, maybe itās your case too. I guess your web is only able to show the pages and posts that have been fetched from the server. The ones you try to fetch from localhost
return that error.
In order to āsolveā it I installed this Chrome extension, moesif, and turned it to on
. It doesnāt solve the problem but it lets you see the whole web from local. Once you deploy your app to a real domain, the CORS problems should be solved. You could test it by deploying it to a different domain than the real one (like the one Zeit Now gives you by default, mysite.now.sh).
This guy here explains it much better.
Not sure if itās your case, let us know if you find it helpful.
This is really a very frustrating error.
thanks guys for all this support
It looks like the path of the failing request is not /pages
but /
. And for what I know the only calls that should be done are to /posts
and /pages
, so it looks like you are doing an extra request for some reason that is failing.
Can you post the code where you are doing this fetchs? Is it in a Link
component? Are you doing it manually from somewhere else? Did you wrote any custom handler
on your Frontity project that might be interfering?
EDIT: I see you marked @SantosGuillamot response as solution. Is it working now?
Weāve seen this problem too last week.
It looks like WordPress returns an error for urls ending with a slash:
...wp/v2/posts/?_embed...
and it doesnāt return an error for urls not ending with a slash:
...wp/v2/posts?_embed...
@modyydom could you please confirm if thatās the case? The Chrome devtools in our case looked identical to yours. And if thatās the case, where are you hosting your WP? Is it a one-click install of DigitalOcean?
Hi @luisherranz
In my case it is completely the opposite
you can see that with slash it is ok and without it throws an error
Iām using Local by FlyWheel as my wordpress server that runs nginx
I donāt know it these info is helpful
BUT thank you for your care guys, you are the greatest.
Ok, I see, thanks.
Maybe itās a problem with the 301 redirections of Apache/Nginx (in our case we use Apache) not having the CORS headers.
This is only a hypothesis, I havenāt tested it, but itās the only explanation that comes to my mind right now.
What happens if you add the CORS headers in Nginx instead of in WordPress? Does it solve the issue?
if ($request_method = 'GET') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Headers' '*';
add_header 'Access-Control-Allow-Methods' 'POST, GET, OPTIONS, PUT, DELETE';
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
}
@modyydom Iāve been able to reproduce the problem. Itās something going on with the REST API - Head Tags plugin. If you turn it off, it should work again.
Weāre going to investigate the issue, open a bug and solve it as soon as possible.
Exactly, I can confirm That.
Every many CORS errors are working well now, BUT not all especially when moving from page to another.
Thanks and I really hope to be solved
Can you please share the issue ticket here so I can subscribe to it as I canāt find it on github
Thanks in advance @luisherranz
Hi, Iād the same problem (we talked 'bout that here => Categories, Tags and Author archive gone to 404 error).
Iāve find out two things:
In fact, Iād a custom function active on many installation, that I totally forgot, that was meant to add some rest functionality, but in fact it added some CORS headers that locked some interaction in a silly way as is doing on you.
Try disabling all plugins, mu-plugins and custom theme to check if thereās something that is going on in your installation.
Iād a similar problem even on a blank installation, but, as I said in the other post, the problem is related to the category SLUG that must be ācategoryā to let Frontity fetch categories data, not CORS.
You can change it using categoryBase
Iāve answered to you in the original post: Categories, Tags and Author archive gone to 404 error
Hey, we have fixed the issue and released a new version.
@modyydom, could you update the REST API - Head Tags plugin and check if the errors appear now?
woooooooow
Frontity team rocks !!
you are amazing
every thing is perfect now
They totally do!