Post preview and oembed provider issue using polylang plugin with subdomains

  • ( X ) I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
  • ( X ) The issue still exists against the latest master branch of Polylang and the latest WordPress version.
  • ( X ) This bug happens with only Polylang plugin active
  • ( X ) This bug happens with a default WordPress theme active
  • ( X ) I can reproduce this bug consistently

Steps to reproduce the issue

  1. Ubuntu 20.04 + nginx + mysql 8 + latest woordpress + permalinks + subdomain + polylang with subdomain option + cloudflare dns proxy
    1.2. Open WP dashboard at domain.com -> add new post for the language your subdomain.domain.com is at -> write something in the post -> preview -> open in new tab
    1.3. You are taken to subdomain.domain.com/p=2342, where in turn you are greeted with a WP 404 page not found. The preview has been generated at domain.com/p=2342. You are able to access the preview, by typing the domain.com/p=2342 manually.

  2. Ubuntu 20.04 + nginx + mysql 8 + latest woordpress + permalinks + subdomain + polylang with subdomain option
    2.2. Open WP dashboard at domain.com -> add new post for the language your subdomain.domain.com is at
    2.3. Paste a link of subdomain.domain.com/any-post-link-url-encoded-transliteration
    2.3. The woordpress link generator can’t process the link of the subdomain.domain.com/any-post-link-url-encoded-transliteration and receive a metainfo about the post

Expected behavior and actual behavior

  1. Post preview link takes to subdomain.domain.com instead of domain.com, where the link is generated.
  2. for the oembed link to open a modal showing the usual picture and metainfo about the post from the subdomain.domain.com site.

Any guidance would be very appriciated.

I didn’t find anything related to this issue nor on stackoverflow, nor on woordpress, nor here among issues.
I have searched through all the posts in all the places you list on this github readme, also.

What I have already tried to solve your issue

  1. Preview link
    1.1. unsuccessful nginx, .htaccess and php header rewrites
    1.2. nginx proxy for subdomain.domain.com to domain.com
    1.3. expanding server name
    1.4. unsuccessful tracing of the url creator in wp-admin, wp-includes and wp-content folders. All of them returned domain.com, as it should be.
    1.5. serving subdomain.domain.com and domain.com in seperate nginx server blocks
    1.6. in wp dashboard -> language -> settings -> url modification -> switching between subdomain option, vs custom domains -> entering the same domains.

  2. Oembed
    2.1. Added a oembed provider in functions.php wp_oembed_add_provider( ‘https://subdomain.domain.com/*’, ‘https://domain.com/oembed/’, false );
    2.2.
    image
    2.3. The endpoint at which the oembed is requested from the new post frontend is https://rutest.mainampasauli.news/wp-json/oembed/1.0/proxy?url=https://rutest.mainampasauli.news/hukuygiuygiuyg/&lang=ru&_locale=user So I tried a couple of urlencoded and regular permutations with this request. Unsuccessful.