What is the best way to disabled front-end when using WordPress has headless?

Edit the constant WP_USE_THEMES in index.php to false, to avoid loading any theme as part of the WordPress loop sequence.

 define( 'WP_USE_THEMES', false); 

Reference: https://github.com/WordPress/WordPress/blob/master/index.php#L14

See also: https://codex.wordpress.org/The_Loop#Using_The_Loop

error code: 523