3rd: Disable LiteSpeed Cache in the Cornerstone editor (like Elementor) - #1022
robertstaddon wants to merge 1 commit into
Conversation
…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>
|
@robertstaddon Will this PR fix issue #1023 ? I will forward to developers, and we will come back with answer about what we will do next. |
|
@robertstaddon by the way: have you tested 'dev' build? |
|
@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. |
|
@robertstaddon if dev is not working I notify the devs :) |
|
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. |
Summary
litespeed_disable_allon the editor app path (default/cornerstone, or a customcustom_app_slug) and on requests whoseHTTP_REFERERis that app — the same approach used for Elementor.wp_create_nonce( 'wp_rest' )into an HTML comment insidewp_localize_script/csAppConfigJSON when the builder loads on the frontend, which causesSyntaxError: Invalid or unexpected tokenand dumps the builder config as plain text.Cornerstone (Pro theme / standalone) defines
CS_VERSIONand serves the editor outsidewp-admin, so LiteSpeed’s admin bypass does not apply and the predefinedwp_restESI nonce corrupts the page.Test plan
/cornerstone/and confirm the builder UI loads (no wall of text / console SyntaxErrors onwp-api-fetch/cs-app-js-extra).<!-- Block uncached by LiteSpeed Cache -->or[an error occurred while processing this directive]).Made with Cursor