Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blank Redirect Catch #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

ThyNameIsMud
Copy link

@ThyNameIsMud ThyNameIsMud commented Jun 4, 2021

Adds catch for users who set the defined variable as blank. This issue is likely to come up for users who use ElasticBean Stalk and multiple environments. You will want to redirect to different static sites depending on the environment, ie, stage site, production site. You make the change to your code:

<?PHP
define( 'HEADLESS_MODE_CLIENT_URL', env('FRONTEND_SITEURL' ));

Now say you forgot to add that variable to an environment. That will create a redirect loop that sends the header Location: / and you might go slightly mad attempting to debug.

@Benunc Benunc requested a review from Shelob9 March 27, 2023 18:37
@Benunc
Copy link
Collaborator

Benunc commented Mar 27, 2023

@Shelob9 I'd love your review here. I don't see a downside to also catching a blank state, but would love more eyes than mine on it.

@@ -109,7 +109,8 @@ function headless_mode_disable_front_end() {
! defined( 'DOING_CRON' ) &&
! defined( 'REST_REQUEST' ) &&
// prevents the case of a new user activating the plugin but not yet setting the constant. Added in 0.3.0
HEADLESS_MODE_CLIENT_URL !== 'https://hiroy.club' &&
// prevents the additional case of setting the const via an enviroment variable and forgetting to set the variable
Copy link
Owner

Choose a reason for hiding this comment

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

"enviroment variable" should be "constant"

@Shelob9
Copy link
Owner

Shelob9 commented Mar 27, 2023

@Benunc This looks fine to me. Didn't test it though. If it works, merge it

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.

3 participants