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

Added header for the redirect from Post ID #218

Merged
merged 3 commits into from
Nov 18, 2020

Conversation

jamesmorrison
Copy link
Member

Description of the Change

This PR adds the redirect post ID to the HTTP response headers. Its' purpose is to aid debugging where a redirect is coming from.

Where there are a large number of similar redirects e.g. for "reviews" it can be hard to pinpoint exactly where the active redirect is coming from.

Alternate Designs

N/A

Benefits

The addition of the Post ID will help developers see which redirect rule took effect.

Possible Drawbacks

The ID of the redirect post will be available to anyone looking at the headers. I don't believe this is a security concern since external users won't be able to achieve anything with this.

Verification Process

I set up a local install with SRM as the only active plugin; I setup a redirect, cleared the transient cache and loaded the URL that would trigger the redirect rule.

I confirmed that the post ID (5 in this case) shows in the response headers.

Checklist:

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests passed.

Applicable Issues

N / A - this doesn't directly relate to an issue here, I just needed to debug where a redirect was coming from.

Changelog Entry

Added redirect Post ID to response headers where a redirect rule is invoked.

@jeffpaul jeffpaul added this to the 2.0.0 milestone Oct 16, 2020
Copy link
Collaborator

@dinhtungdu dinhtungdu left a comment

Choose a reason for hiding this comment

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

@jamesmorrison This is looking good to me 🎉. I just have a small question/concern about the naming.

redirect_post_id makes me think that it the post ID which is redirected from, not the id of redirect itself. redirect_id and X-Safe-Redirect-ID are clearer for me. What do you think?

@jamesmorrison
Copy link
Member Author

@dinhtungdu I updated the redirect post ID header name to X-Safe-Redirect-ID

@dinhtungdu
Copy link
Collaborator

@jamesmorrison Thanks for your work. We will get this one merged shortly.

@jeffpaul
Copy link
Member

@jamesmorrison I'm seeing a Travis failure, are you able to look into that and see if there's a fix needed to address that?

@jeffpaul jeffpaul mentioned this pull request Nov 17, 2020
18 tasks
@dinhtungdu
Copy link
Collaborator

@jeffpaul look like we have a Travis error for push build, this is Travis error, it's not related to this PR. The build for pr is passed so it's safe to merge this one.

@jeffpaul jeffpaul merged commit 3c1ad60 into 10up:develop Nov 18, 2020
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.

None yet

3 participants