[wp-trac] [WordPress Trac] #54758: Front page not embeddable when using a static page_on_front
WordPress Trac
noreply at wordpress.org
Fri Jan 7 09:11:15 UTC 2022
#54758: Front page not embeddable when using a static page_on_front
-------------------------------------------------+-------------------------
Reporter: dd32 | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting
| Review
Component: Canonical | Version:
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests needs- | Focuses:
testing |
-------------------------------------------------+-------------------------
Changes (by dd32):
* keywords: has-patch has-unit-tests => has-patch has-unit-tests needs-
testing
Old description:
> When a site is configured with a page_on_front, Canonical kicks in and
> redirects the user to the homepage.
>
> This is caused by Canonical not being embed-aware.
>
> As an example, the WordPress.org homepage should be embeddable:
> {{{
> $ curl -Is https://wordpress.org/embed/ https://en-
> au.wordpress.org/embed/ | grep -E '^(HTTP|location)'
> HTTP/2 301
> location: https://wordpress.org/
> HTTP/2 301
> location: https://en-au.wordpress.org/
> }}}
>
> The non-pretty embeds do however work, unfortunately WordPress doesn't
> link to these when rewrites are enabled:
> {{{
> $ curl -Is https://wordpress.org/?embed=1 https://en-
> au.wordpress.org/?embed=1 | grep -E '^(HTTP|location)'
> HTTP/2 200
> HTTP/2 200
> }}}
>
> After the PR attached to this ticket:
> {{{
> $ curl -ILs https://wordpress.org/embed/ https://en-
> au.wordpress.org/embed/ | grep -E '^(HTTP|location)'
> HTTP/2 200
> HTTP/2 200
> }}}
>
> The fix attached is a combination bugfix/enhancement, as I've fixed the
> bug by making canonical embed aware, so it redirects to the canonical
> embed location.
>
> The PR isn't complete, as it appears to still fail on one of the
> testcases I added, and appears to have altered (Potentially fixed?) the
> behaviour of another canonical test.
>
> A more targeted fix would be to disable canonical when `is_embed()` is
> truthful.
New description:
When a site is configured with a page_on_front, Canonical kicks in and
redirects the user to the homepage.
This is caused by Canonical not being embed-aware.
As an example, the WordPress.org homepage should be embeddable:
{{{
$ curl -Is https://en-au.wordpress.org/embed/ | grep -E '^(HTTP|location)'
HTTP/2 301
location: https://en-au.wordpress.org/
}}}
The non-pretty embeds do however work, unfortunately WordPress doesn't
link to these when rewrites are enabled:
{{{
$ curl -Is https://en-au.wordpress.org/?embed=1 | grep -E
'^(HTTP|location)'
HTTP/2 200
}}}
After the PR attached to this ticket:
{{{
$ curl -ILs https://en-au.wordpress.org/embed/ | grep -E
'^(HTTP|location)'
HTTP/2 200
}}}
The fix attached is a combination bugfix/enhancement, as I've fixed the
bug by making canonical embed aware, so it redirects to the canonical
embed location.
The PR isn't complete, as it appears to still fail on one of the test-
cases I added, and appears to have altered (Potentially fixed?) the
behaviour of another canonical test.
A more targeted fix would be to disable canonical when `is_embed()` is
truthful.
--
--
Ticket URL: <https://core.trac.wordpress.org/ticket/54758#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list