-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CloudFlare blocking REST API PUT Request (Draft Doesn't Get Saved) (solved by an update from Cloudflare) #2704
Comments
I have a sneaking suspicion that this is actually not a Gutenberg fault, but a deeper one with the REST api. |
Yeah, I have pretty permalinks set up. I even used a front end post submission plugin that's built with REST API and it works. |
This may be a duplicate of #1935. |
@westonruter I'm afraid you're right. Looks like there's an issue with the PUT https://a2podcast.com/wp-json/wp/v2/posts/44 403 () for
|
What is the request/response data for the API request? |
@rmccue I have the similar log as of @JustinSainton It still doesn't work. |
What is the response payload that accompanies this? |
@rmccue Thanks for asking the right question. I haven't looked at the response payload. Turns out CloudFlare is the reason why this is happening. I disabled CloudFlare on one of my domains to check if this works and it did. But this again is a big problem. So many sites are hosted on CloudFlare. I am currently looking into what is causing CloudFlare to ban the IP for adding a draft via Gutenberg. Looks like the I have no page rules set. Nothing. Looks like default configurations of CloudFlare are banning the API from posting via Gutenberg. |
Looks like CloudFlare has a globally enabled rule set in WAF — even for free users — that no one can even disable (AFAIK). Here are the details https://blog.cloudflare.com/protecting-everyone-from-wordpress-content-injection/ I wonder if @aaroncampbell could help with this — I can see his comments on the post. Looking forward! |
I'm not using Cloudflare, but this is interesting. I suppose something at the server-level with the host (We're on Siteground) could be blocking PUT requests. I'll ask them about this. |
@rmccue And my response payload is the CPanel 403 HTML response, fwiw: |
Interesting. Based on this, it seems like it may be a REST API issue with these hosts. We may need to reach out and see about fixing this. If you switch Gutenberg to use POST instead of PUT, does this still occur? (The API accepts POST everywhere it accepts PUT, but you can also do |
@rmccue How do you propose would one switch from |
Do the same PUT request you are doing as a POST request instead and add the request arg |
@rmccue Found the source. In our case, Siteground had put the following block in our .htaccess file
This was the root cause of the issue. I hadn't had the opportunity to attempt anything to prove the case, but I assume the DELETE and OPTIONS methods would have also failed. |
@JustinSainton Nice digging! DELETE, OPTIONS, and PUT all need to be whitelisted for the API (OPTIONS is used by browsers automatically for cross-origin requests). Was this specific to your site, or a SiteGround-wide thing? If the latter, I'll try and follow up with them. |
@rmccue I'm not certain whether or not this is SiteGround-wide or not - I vaguely recall their support team modifying our htaccess file years ago, for some reason. So it may not be that widespread, but certainly feels like something to account for and educate hosts on. |
This definitely gives pause when you consider what it means for broader use of the REST API. First-party use of all the API methods in core in wp-admin (with helpful error messages) would expose and get these fixed very quickly. |
This has come up once or twice before (IIRC, GoDaddy and WP Engine), and the hosts are usually pretty responsive. Luckily, blocking methods tends to be a thing that only the big hosts do for "protection". Will definitely follow this up with SG to find out if it's a local or global thing. (A bigger concern there is authentication, which is much worse, but not relevant to built-in stuff like Gutenberg.) |
Couldn't agree more. But as Matt suggested, having Gutenberg depend on WP REST API will lay the groundwork for better REST API enabled future for WordPress apps. |
This is fairly certainly a duplicate of #2565 |
@JustinSainton - I'm on SiteGround myself and was kicking the tires on Gutenberg earlier this evening on my development site: After an initial publishing of a post, I cannot update the post for the life of me. While I do not think I had my htaccess file edited the way yours was, I'm wondering if something similar is going on. Looks like I'm off to open a ticket with SiteGround. |
Hey, folks! 🙌 Feel free to reopen it if there are other similar issues. 🔥 |
@caraya please keep this thread updated if you have any news. I'm facing the same issue trying to use instagram embedded photos or something from a trusted source. It makes sense to block those requests for cloudflare but should be a section where we can add trusted sources. [Related to XSS attack] |
Issue seems not resolved yet, I am experiencing it today with the latest Wordpress version:
Update: Solved! Problem was caused by custom rule in .htaccess |
I have read in several places that the fix is to use a paid ssl cert from cloudflare, not their universal free one. Am not using the CloudFlare wordpress plugin. Server response headers still indicate a cloudflare response:
|
For the api request: Problem is here: Therefore the request never executes.
On a working site, it looks like this:
Am working on digging deeper. Would appreciate any insights from those that know what they're doing.
|
Aslo the draft is autosaved, its only updating that fails now |
@mike-pt do the Cloudflare error logs show anything? how about the server logs? Check that before disabling rules as it may not be the reason why it's not working. Try disabling your plugins and test if it works. If it does try activating the plugins one by one until it stops working. If it doesn't then developers will need logs from Cloudflare and your server to see if they can troubleshoot it further. |
Error logs from cloudflare? I don't think they provide that, however I have pasted the screenshot from cloudflare blocking this, and I do see a 403 on the browser none of this are the WP WAF rules, but OWASP, and a lot of those are not common false positives! This as to do with how gutenberg uses the JSON API when updating posts, so maybe the problem is on the API side still it hits at least the rules I've pasted above! I don't think plugins have anything to do with this, since its clear that the request is made when using gutenberg, as a workaround the classic editor is in use, no issues there! |
It's the Web Application Firewall event log, not error log, my bad.
If the JSON API is not working that's usually a WAF issue, not IP firewall issue. At least it was for me before the Gutenberg team solved it. It may also be related to PHP Security plugins that are blocking things without you realizing they are (this has also been reported as an issue in this and other threads) |
Yeah and that's exactly what I've pasted above... I never mentioned IP blocks only WAF rules. This still happens, I have to disagree on the PHP security plugins cause the screens I posted are from Cloudlfare WAF log and its clearly blocking things, based on a few OWASP rules (note that none are from the Wordpress specific rules in this screenshot) |
@caraya I feel like you took this too personal, I'm not rejecting any solutions (but so far no solution was really provided, but you did provide useful opinions on possible issues that could be related, and let me thank you for that). With that sad if I disagree with something and provide an explanation as to why I don't see why that means I'm Now still back to the PHP security Plugins, the screens I posted are from cloudflare, NOT wordpress, cloudflare is blocking the request based on the rules I've posted as a screenshot, the request doens't even get to the host, so how could a php security plugin do it? I'm happy to share more examples / more details on what cloudflare is blocking to try to understand the problem. P.S. If you felt offended at any point it was honestly never my intention, I simply was replying directly and honestly to you're comments, I hope this helps clarify things! |
If you follow these and other issues with the plugin not updating you'll see that there are multiple reasons why this happens. Your screen is not what I expect to see when I troubleshoot this type of issues and I don't think I mentioned you're disagreeing, it's your right :). Since you've confirmed that this is the web application firewall then, to me, it's a new error but, like the others, I'm guessing it doesn't like the way Gutenberg is mixing comments and JSON and considers it an attempt at SQL injection. So yes, it's likely that new modsecurity rules are making it not work but I'm surprised other people are not having the same issue... it still may be something being injected between your client and the firewall (ads, malware, long etc) This is a new type of WAF error in Cloudflare, It's reporting a different type of error for protection against SQL injection but it's none of the previously reported errors. It is triggering OWASP core rules, specifically something in the APPLICATION-ATTACK-SQLI group of rules (Github link), Don't know why it would be triggering now, but Cloudflare uses OWASP as their default module |
To clarify that screen is form:
[From Cloudflare] After selecting the corresponding block.... I did crop it to filter out the IP etc... and simply show the "triggered/matched" rules. But yeah what surprised me is that cloudflare lists Also I haven't tried gutenberg again after the day I posted this, it was disabled in the prod but I should probably check again if this is still happening to clear out the possibility of a cloudflare bug analyzing this. |
Hi, I'm facing the same issue with Cloudflare and the OWASP ruleset. If i turn the OWASP rule set off (while keeping the Cloudflare rule set on), everything works fine. I've done some tests adjusting the OWASP sensitivity (high/medium/low): the longer the post content, the greater the chances of the request being blocked. I haven't really tested this super thoroughly, but I also think that having a lot of markup increases the chances. I had a page with a table and many links in it. I could not update it (OWASP rule was triggered). After cleaning it up a little bit (removing target="_blank" an rel="noopener" from the links) it did get saved. Cheers, |
I have noticed something else: autosaves do work (and the json is almost the same), it's the publish/update request that gets blocked... |
@jordif out of curiosity which rules does it it for you? |
@mike-pt Mainly "SQL Injection" and "XSS attack" rules. It seems the OWASP team are already aware of this and working on a solution. SpiderLabs/owasp-modsecurity-crs#1232 So I'm afraid we'll have to wait (and whitelist IPs in the meantime) |
Hi Guys, any news on this? I have a business to run, it relies entirely on my website working and don't have time for all this tech stuff slowing me down all the time. I've almost lost hope in WordPress altogether after the trouble I'm having now and I really can't afford to have my site totally re-built on another platform. It's times like these I wish I was still using a simple Godaddy builder or something. I can't afford the amount of time I'm spending on WordPress just to keep it working. I don't ask too much, just a simple site that I can edit and update. What year are we living in? Any advice or direction on what I need to do or who I need to reach out to for help would be appreciated. Or should I just go back to classic and forget about Guttenberg until it works one day with my existing setup? If Cloudflare are still working on it then how much longer will it take? |
All this banter about the politics of problem solving and who is to blame is ridiculous. The problem is that Gutenberg has an absolutely useless generic error message, offering a wide array of solutions. Identification of issue1.) Identify the network request in Chrome developer console (big red line). RecapTo clarify, this is a closed issue, and you likely will not find help on here. But the above generic self-help debugging steps are a first step to identifying the actual problem for Gutenberg's useless error message. |
Thanks ensemblebd, I've passed your debugging steps on to WPEngine who were looking into it further for me and have opened a support ticket. I'll get back on here and let you know if I find out what they did to solve it. |
@ausworkshop Did you ever get this sorted? I've been working with WPEngine for over a month on the exact same problem. |
I'm not sure if it was ever fixed sorry, don't think so, I've been struggling along with the classic editor, stopped using Gutenberg months ago but I am planning to build a whole new site using Beaver Builder, even that I'm struggling with. Sick of trying to get my head around all this crap. Here I am at midnight trying to work out how to import and display custom post types in a new theme. I had to hire someone in the end. I'm hopeless with all this and it never seems to get easier, just more confusion and more expenses. Was quoted $6k to fix my site, I refused so am doing it all myself. Wish me luck! :) Have fun people. |
@ausworkshop Who's your host? I'm with AWS and had to add |
I'm with WPEngine, not sure what was done to fix this as it was so long ago but I am still getting used to using Gutenberg. I had to hire someone from Codeable back in May as I found it difficult to continue to work things out by myself. It seems the more things 'improve' with updates and upgrades in this world the less I am able to figure out by myself. |
Glad you got it sorted in the end. |
[UPDATE: Cloudflare rolled out a fix for problems with the
WP0025B
rule 8-Aug-2018, please update.]I have started to try Gutenberg on a production site and it is not working. The site is new and has no other plugin installed. Looks like the
PUT
request is not working.I am using the latest version of Gutenberg
1.1.0
available in the WP Repo.I have also tried this on two other sites and same error.
I thought I should report it here?
The text was updated successfully, but these errors were encountered: