Skip to content

Commit

Permalink
Merge branch 'canary' into site-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
blakewilson committed Oct 14, 2021
2 parents 9b6c8d6 + 7be3af0 commit 449cb28
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions plugins/wpe-headless/includes/deny-public-access/callbacks.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,20 @@
exit;
}

add_action( 'parse_request', 'wpe_headless_deny_public_access', 99 );
add_action( 'template_redirect', 'wpe_headless_deny_public_access', 99 );
/**
* Redirects non-API requests for public URLs to the specified front-end URL.
*
* @param object $query The current query.
*
* @return void
*/
function wpe_headless_deny_public_access( $query ) {
if ( ! wpe_headless_is_redirects_enabled() ) {
function wpe_headless_deny_public_access() {
if ( ! wpe_headless_is_redirects_enabled() || is_customize_preview() ) {
return;
}

$frontend_uri = wpe_headless_get_setting( 'frontend_uri' );

if (
defined( 'DOING_CRON' ) ||
defined( 'REST_REQUEST' ) ||
is_admin() ||
is_customize_preview() ||
( function_exists( 'is_graphql_http_request' ) && is_graphql_http_request() ) || // From https://wordpress.org/plugins/wp-graphql/.
! empty( $query->query_vars['rest_oauth1'] ) || // From https://oauth1.wp-api.org/.
! property_exists( $query, 'request' ) ||
! $frontend_uri
) {
if ( ! $frontend_uri ) {
return;
}

Expand Down

1 comment on commit 449cb28

@headless-platform-by-wp-engine

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Branch site-dev was deployed successfully
Your environment Development of app faustjs-site was successfully updated
View build logs: https://my.wpengine.com/atlas#/faustjs-site/cixzyt38dn5ak04xxcqc36lf/dej36d1csbli4bm06mzl7y7r
View your environment URL: https://hcixzyt38dn5ak04xxcqc36lf.js.wpenginepowered.com

Please sign in to comment.