Make WordPress Core

Opened 9 years ago

Closed 8 years ago

Last modified 8 years ago

#42313 closed enhancement (fixed)

Introduce an X-Redirect-By header

Reported by: joostdevalk Owned by: SergeyBiryukov
Priority: normal Milestone: 5.1
Component: Canonical Version:
Severity: normal Keywords: has-patch
Cc: Focuses:

Description

Diagnosing redirect loops can often be very confusing because many parts of a system can perform a redirect. The introduction of the X-Redirect-By header would allow the application to be identified more easily.

Yoast SEO already sends this header and we've found it to be very useful many a time, at nearly no overhead.

Attachments (5)

42313.diff​ (880 bytes ) - added by joostdevalk 9 years ago.
Patch
42313.2.diff​ (892 bytes ) - added by joostdevalk 9 years ago.
Patch v2
42313.3.diff​ (936 bytes ) - added by joostdevalk 9 years ago.
Patch v3, check return value for filter
42313.4.diff​ (1.5 KB ) - added by NathanAtmoz 9 years ago.
Add $x_redirect_by parameter to wp_redirect()
42313.5.diff​ (1.2 KB ) - added by pratikkry 8 years ago.
@since updated to 5.0.3

Download all attachments as: .zip

Change History (23)

@joostdevalk
9 years ago

Patch

@joostdevalk
9 years ago

Patch v2

@joostdevalk
9 years ago

Patch v3, check return value for filter

#1 @SergeyBiryukov
9 years ago

  • Owner set to SergeyBiryukov
  • Status new → accepted

#2 @SergeyBiryukov
9 years ago

  • Resolution → fixed
  • Status accepted → closed

In 42408:

Canonical: Introduce x_redirect_by filter that allows applications to identify themselves via X-Redirect-By header when they're doing a redirect.

Props joostdevalk.
Fixes #42313.

#3 @SergeyBiryukov
9 years ago

In 42409:

Canonical: After [42408], remove sprintf() call for consistency with Location header.

See #42313.

#4 @johnbillion
9 years ago

  • Keywords has-patch removed
  • Resolution fixed
  • Status closed → reopened

I really like the idea of this header, but I think we can make the implementation even better.

If the header value could be passed as a parameter in addition to via a filter, it would save the need to call add_filter() immediately before calling the redirect function.

Thoughts?

@NathanAtmoz
9 years ago

Add $x_redirect_by parameter to wp_redirect()

#5 @NathanAtmoz
9 years ago

Since the $status can be passed as a parameter and then modified by a filter, it makes sense that $x_redirect_by should be treated the same way.

#6 @SergeyBiryukov
9 years ago

  • Resolution → fixed
  • Status reopened → closed

In 42633:

Canonical: Add $x_redirect_by parameter to wp_redirect() that allows applications doing the redirect to identify themselves.

This complements the x_redirect_by filter added in [42408].

Props NathanAtmoz, johnbillion.
Fixes #42313.

#7 @johnbillion
9 years ago

  • Keywords needs-patch added; dev-feedback removed
  • Resolution fixed
  • Status closed → reopened

The parameter needs adding to wp_safe_redirect() too.

#8 @johnbillion
9 years ago

  • Resolution → fixed
  • Status reopened → closed

In 42647:

Canonical: Add $x_redirect_by parameter to wp_safe_redirect().

See [42633] and [42408].

Fixes #42313.

#9 @johnbillion
8 years ago

  • Milestone 5.0 → 5.0.1
  • Resolution fixed
  • Status closed → reopened

@since needs updating

#10 @pento
8 years ago

  • Milestone 5.0.1 → 5.0.2

#11 @pento
8 years ago

  • Milestone 5.0.2 → 5.0.3

@pratikkry
8 years ago

@since updated to 5.0.3

#12 @pratikkry
8 years ago

  • Keywords has-patch added; needs-patch removed

#13 @audrasjb
8 years ago

  • Keywords needs-refresh added

Hi,

5.0.3 is going to be released in a couple of weeks. We are currently sorting the remaining tickets in the milestone. The ticket is sorted in milestone 5.0.3, but requires @since and a commit/backport to the associated branch. That would be great to have a quick refresh.

#14 @audrasjb
8 years ago

@pratikkry thanks for the refresh but the patch you sent seems incomplete ;-)

#15 @audrasjb
8 years ago

  • Keywords needs-refresh removed

Ok sorry @pratikkry I was wrong, your patch is ok.

This ticket was mentioned in ​Slack in #core by audrasjb. ​View the logs.


8 years ago

#17 @desrosj
8 years ago

  • Resolution → fixed
  • Status reopened → closed

In 44386:

Docs: Update since tag for X-Redirect-By header additions.

See [42408-42409], [42633], [42647].

Fixes #42313.

#18 @desrosj
8 years ago

  • Milestone 5.0.3 → 5.1
Note: See TracTickets for help on using tickets.