Skip to content

3rd: Disable LiteSpeed Cache in the Cornerstone editor (like Elementor) - #1022

Open
robertstaddon wants to merge 1 commit into
litespeedtech:devfrom
robertstaddon:3rd-cornerstone-editor
Open

robertstaddon wants to merge 1 commit into
litespeedtech:devfrom
robertstaddon:3rd-cornerstone-editor

Conversation

@robertstaddon

Copy link
Copy Markdown
Contributor

Summary

  • Adds a Cornerstone third-party integration that calls litespeed_disable_all on the editor app path (default /cornerstone, or a custom custom_app_slug) and on requests whose HTTP_REFERER is that app — the same approach used for Elementor.
  • Fixes ESI rewriting wp_create_nonce( 'wp_rest' ) into an HTML comment inside wp_localize_script / csAppConfig JSON when the builder loads on the frontend, which causes SyntaxError: Invalid or unexpected token and dumps the builder config as plain text.

Cornerstone (Pro theme / standalone) defines CS_VERSION and serves the editor outside wp-admin, so LiteSpeed’s admin bypass does not apply and the predefined wp_rest ESI nonce corrupts the page.

Test plan

  • On a site with LiteSpeed Cache + ESI enabled and Pro/Cornerstone active, open /cornerstone/ and confirm the builder UI loads (no wall of text / console SyntaxErrors on wp-api-fetch / cs-app-js-extra).
  • Confirm view-source shows a normal REST nonce string (not <!-- Block uncached by LiteSpeed Cache --> or [an error occurred while processing this directive]).
  • With a custom Cornerstone Path set, confirm the editor still loads and LiteSpeed stays disabled on that path.
  • Confirm a normal frontend page still caches / uses ESI as before when not editing in Cornerstone.

Made with Cursor

…mentor).

Cornerstone loads on a frontend app path (/cornerstone by default), so ESI was
rewriting wp_rest nonces into HTML comments inside localized JS and breaking
the builder. Mirror Elementor's litespeed_disable_all approach for editor
requests and Cornerstone-referer AJAX/REST.

Co-authored-by: Cursor <cursoragent@cursor.com>
@timotei-litespeed

Copy link
Copy Markdown
Contributor

@robertstaddon
Thank you for the PT. We cannot offer support for paid plugins/themes

Will this PR fix issue #1023 ?
Make sure the code is well tested and it works, not changing other pages functionality. Also make sure there are no warning or notices in php.
From what I see the code seems good.

I will forward to developers, and we will come back with answer about what we will do next.

@timotei-litespeed

Copy link
Copy Markdown
Contributor

@robertstaddon by the way: have you tested 'dev' build?
we have added: #1006 added

@robertstaddon

robertstaddon commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

@timotei-litespeed Yes! the dev build with #1006 is great! Thank you!

This pull request does fix issue #1023 and I currently have it deployed on a live site and it's working well to allow Cornerstone to run with LiteSpeed ESI enabled. No PHP or JavaScript errors. This pull request simply turns off LiteSpeed caching when editing pages with Cornerstone, just like Elementor. I scanned the change with Claude Fable and it came back with the conclusion that this pull request looked solid.

@timotei-litespeed

Copy link
Copy Markdown
Contributor

@robertstaddon if dev is not working I notify the devs :)

@robertstaddon

Copy link
Copy Markdown
Contributor Author

Hello @timotei-litespeed . Yes, the current dev branch does not currently fix issue #1023. We need this pull request merged into dev to allow Cornerstone to work with LiteSpeed ESI correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants