Support » Plugin: Gutenberg » Won’t preview a post draft, or published post

  • Resolved obsidianurbex

    (@obsidianurbex)


    Hi

    When I click “Preview” I get a page loading with

    title “about:blank”

    and text

    “Please wait…

    Generating preview.”

    Nothing happens πŸ™

Viewing 15 replies - 1 through 15 (of 20 total)
  • Moderator Marius L. J.

    (@clorith)

    Hiya,

    Are you able to manually save a page draft, and then click the preview button a few seconds after getting the message saying the post has been saved? Are you possibly receiving any errors when trying to save?

    Hi

    I try clicking save draft and that works, but still nothing happens when I click preview. I also try clicking the Permalink from within the Title Block and the page loads only the “Auto draft” title loads and not any of the changes I has made before hitting save draft. It looks like the pages are not saving at all.

    Things I have done:
    Disabled Cloudflare (after whitelisting my IP)
    Checked no .htaccess block on “put”
    Removed my cache plugin (WP-Rocket)
    Removed my All in One WordPress Firewall

    • This reply was modified 11 months, 2 weeks ago by  obsidianurbex.
    Moderator Marius L. J.

    (@clorith)

    Hmm, that’s odd.

    Do you see any JavaScript errors in your console (you can see how to check for console errors in step 3 of our codex article)

    Hi

    Thanks for that, this is what I get in Chrome:

    ?v=2.0:6 WebSocket connection to ‘wss://public-api.wordpress.com/pinghub/wpcom/me/newest-note-data’ failed: Error during WebSocket handshake: Unexpected response code: 403
    m @ ?v=2.0:6
    short-pixel.min.js:1 Empty queue 4437->4437
    ?v=2.0:6 WebSocket connection to ‘wss://public-api.wordpress.com/pinghub/wpcom/me/newest-note-data’ failed: Error during WebSocket handshake: Unexpected response code: 403
    m @ ?v=2.0:6
    ?v=2.0:6 WebSocket connection to ‘wss://public-api.wordpress.com/pinghub/wpcom/me/newest-note-data’ failed: Error during WebSocket handshake: Unexpected response code: 403
    m @ ?v=2.0:6
    g @ ?v=2.0:6
    v @ ?v=2.0:6

    Moderator Marius L. J.

    (@clorith)

    Those all seem fine, they’re unrelated and not uncommon from Jetpack.

    I must admit, I’m a bit stumped here… I’ve got two more possible things to test though!

    There may be a browser extension doing weird things, could you try using an incognito browser window and seeing if the problem persist then?

    If it does, let’s see if there’s a plugin or theme conflict, normally this would mean disabling all your plugins and then seeing if the problem goes away, but you may also use the Troubleshooting Mode in the Health Check plugin to do this without disabling features for regular site visitors.

    Hi

    I switched to Edge (previously using chrome), which has no extensions. I also put in a a Private browsing tab. Same issue.

    Ran health check with everything deactivated other than Gutenburg, and I deactivated my Cloudflare. Same issue.

    I type a title and some text. When I hit Save Draft…it looks like it has saved, no error, but the title reverts to “Auto Draft”. If i exit and re-open the post draft, it hasn’t saved anything and just has “Auto Draft” as title

    πŸ™

    Plugin Author Andrew Duthie

    (@aduth)

    Hi @obsidianurbex,

    In order to narrow down whether this is an issue on your site, or in your network / browser environment(s), could you try installing Gutenberg on another site and see whether you experience similar issues?

    You can create a free temporary WordPress installation at this site (mind the URL 😬):

    http://poopy.life/

    Hi Andrew

    I have another WordPress site with the same host, I will try that as well to rule out host issues.

    Will report back πŸ™‚

    Ok, It appears to my my .htaccess file.

    I tried:
    Another site, same host, also has Cloudflare – Works ok
    Another site again, same host, Cloudflare not set up – Works ok
    Poopy – Works ok

    Switch to install version htaccess it works on my site, switch back to my current htaccess and it stops.

    I can’t see what is being blocked, maybe you could take a look?

    Moderator Marius L. J.

    (@clorith)

    Hi,

    Yes please do provide us with the content of your .htaccess file and we’d be happy to have a look.

    Hi,

    Right, I have the culprit.

    I force trailing slashes on my site, and if i remove this then Gutenberg works perfectly.

    # START force trailing slash
    <IfModule mod_rewrite.c>
    RewriteCond %{REQUEST_URI} /+[^\.]+$
    RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R=301,L]
    </IfModule>
    # END force trailing slash

    My next issue is I wish to keep this 301 for trailing slash enforcement. I assume this wont be an issue when Gutenberg becomes the default WordPress editor? If that case, I might just wait for the integrated WP release πŸ˜€

    Moderator Marius L. J.

    (@clorith)

    Ahh, yeah this might be the cause indeed.

    I would avoid rewriting or appending anything to API calls, as that can have unexpected consequences, what you may wish to do is exclude both /wp-admin and /wp-json from your rewrite rule.

    @clorith
    Great! Any guidance on what that rule would be? Or, could the above rule be moved into wp-content (instead of root) and would that fix it? This may help me resolve a conflict that another plugin is causing. Thanks.

    Aye it’s definitely the cause, I can break Gutenberg by putting it back and make it work again by removing it and making no other alteration.

    I’m know very little about coding, can you advise how to exclude those within the existing rule I posted please? 😁

    Moderator Marius L. J.

    (@clorith)

    Sure, we can add some conditionals to that bit you already have.

    
    # START force trailing slash
    <IfModule mod_rewrite.c>
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !^/wp-(admin|json)/
    RewriteCond %{REQUEST_URI} /+[^\.]+$
    RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R=301,L]
    </IfModule>
    # END force trailing slash
    

    I added in a check for file and folder paths as well, which should avoid your rule trying to trigger if a file is being accessed directly (since they can’t have / added to them either), it then makes sure that the URL does not start with either wp-admin or wp-json, let me know how that works out for you πŸ™‚

Viewing 15 replies - 1 through 15 (of 20 total)
  • You must be logged in to reply to this topic.