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

[Blueprints] Document why autologin uses absolute URLs for redirects #1971

Closed
wants to merge 1 commit into from

Conversation

bgrgicak
Copy link
Collaborator

This PR explains why autologin uses absolute URLs for redirects by improving the inline documentation of the autologin code.

Testing Instructions (or ideally a Blueprint)

  • Read the full comments
  • Is the documentation missing something?

@bgrgicak bgrgicak self-assigned this Oct 31, 2024
@bgrgicak bgrgicak requested review from akirk and adamziel October 31, 2024 08:54
@bgrgicak bgrgicak added [Type] Documentation Improvements or additions to documentation [Package][@wp-playground] Blueprints [Type] Developer Documentation Documentation for developers labels Oct 31, 2024
*
* The WordPress home url always includes a site scope subdirectory.
* We expect the REQUEST_URI to include the site scope subdirectory,
* but if a request is made using a request handler it's possible
Copy link
Collaborator

Choose a reason for hiding this comment

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

What does it mean that a request is made using a request handler? As in the request handler issues another request?

*/
$redirect_url = $_SERVER['REQUEST_URI'];
if (strpos($redirect_url, '/scope:') === 0) {
$parts = explode('/', $redirect_url);
$redirect_url = '/' . implode('/', array_slice($parts, 2));
}
wp_redirect(
/**
* Safari breaks if the redirect URL is relative so we always
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's briefly explain what does "breaks" mean

@bgrgicak
Copy link
Collaborator Author

bgrgicak commented Nov 1, 2024

This PR will move the redirect fix to the Service Worker to ensure all relative URLs are correctly redirected.

The current PR won't be needed anymore because #1978 removes the fix from autologin.

@bgrgicak bgrgicak closed this Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package][@wp-playground] Blueprints [Type] Developer Documentation Documentation for developers [Type] Documentation Improvements or additions to documentation
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants