Support » Plugin: Jetpack by WordPress.com » Domain Mapping Connect Issue

  • Hello,

    I am using the Domain Mapping Plugin by WPMU Dev on a multisite installation. I have a mapped frontend to another domain, keeping the admin backend to the original main site domain (https://site.com/subsite) . When I connect to JetPack on the sub-site, I can see it picks up the url of the mapped domain, but after authorizing, I get a dialog asking me to input this url again. My understanding of the flow is JetPack tries again to connect to the admin backend using the mapped domain, instead of using the connected url referrer (admin_url). Are there any headers or parameters I can check to ensure that in such a scenario, when a callback for connection is done for JetPack, I return the original admin url instead of the mapped url?

    Thanks

Viewing 14 replies - 1 through 14 (of 14 total)
  • Hi there,

    Sorry about the delay in writing back to you. Can you let me know what version of Jetpack you’re using? Our latest update has changes to try accommodate for setups like yours:

    https://github.com/Automattic/jetpack/pull/5852

    Jetpack will try grab the unfiltered site and home URL.

    We can investigate this further for you if you’re still having problems with the latest version. Could you post your site URL here, so I can have a look?

    If you want it to remain private, you can also contact us via this contact form:
    Contact Support

    Plugin Contributor George Stephanis

    (@georgestephanis)

    Howdy!

    Just confirming that I’m looking into this — finding some interesting interactions, and just got linked to https://premium.wpmudev.org/forums/topic/cant-update-domain-mapping-for-the-past-5-months-because-of-issues?replies=89#post-1270834 which seems to have a lot more backstory.

    If there’s anyone that I should be talking to directly about duplicating and understanding the conflicts, please reach out to me in .org slack — my username is @georgestephanis there, and if you’re not already on it you can join via chat.wordpress.org

    Hey there,

    I am using the latest version of JetPack on a multisite setup. Where the sub site url is mapped, but the sub-site admin is not mapped. Hello @george, sending you an invite 🙂

    Plugin Contributor George Stephanis

    (@georgestephanis)

    Howdy howdy!

    Okay so I’m not sure if it’s /the/ problem, but a problem I’ve found is that I’m getting the following error when trying to load the Jetpack admin page:

    Fetch API cannot load http://mappeddomain.dev/wp-json/jetpack/v4/module/akismet/data?_cacheBuster=1502922616739. Request header field X-WP-Nonce is not allowed by Access-Control-Allow-Headers in preflight response.

    This is because the result of rest_url() is on the front-end domain, and if wp-admin is on a different domain there’s preflight checks for whether headers can be passed around between domains that are getting failed.

    You can see this in a simplified version of what Jetpack is doing here:

    https://gist.github.com/georgestephanis/5a90f8a3919d50278a7e3257613be774

    That will work without domain mapping enabled, but the nonced authenticated rest api requests break with domain mapping in place — it’s the cross-domain requests causing the failures you should be able to see in your browser console.

    Plugin Contributor George Stephanis

    (@georgestephanis)

    Short version, WPMU Domain Mapping is breaking all authenticated Core JSON REST API requests from wp-admin.

    Hey there @georgestephanis,

    Hope you are well today. I managed to get Domain Mapping to get the original mapped domain used in the admin section, but I still get requested to put in the correct domain. In this case the domain is http://mysite/subsite but the front is mapped as http://subsite.domain . My question is, what does JetPack check for when verifying a domain as on the connection screen it shows the original and not the mapped domain. I provided a fix on the forum post here but it only works on JetPack version 4.7.1 .

    Warm Regards
    Paul Kevin

    Plugin Contributor George Stephanis

    (@georgestephanis)

    Which connection screen do you mean? If you can provide the admin url (and optionally a screenshot) you’re referring to, I’ll trace it back to where it’s being sourced.

    Hey there @georgestephanis,

    My admin url is on http://anonyjob.com/test and the mapped domain is on http://munch.anonyjob.com/ . On connection I send http://anonyjob.com/test to JetPack

    Plugin Contributor George Stephanis

    (@georgestephanis)

    Sorry, I meant admin url as in like /wp-admin/index.php?page=jetpack-whhatever#connect or the like. I’m trying to make sure I’m looking at the same thing on a test site that you’re looking at on yours.

    Plugin Contributor George Stephanis

    (@georgestephanis)

    Just spoke with @fanalejr in Slack and it seems his issue is resolved. Happy to investigate further if other stuff seems problematic.

    Hi @georgestephanis

    I’m having the same issue. Would you please tell me how it was resolved?

    Plugin Contributor George Stephanis

    (@georgestephanis)

    Howdy howdy!

    So the resolution (I believe) was that they updated the plugin from WPMUDEV as it had been erroneously rewriting the JSON API endpoint to a different domain, thereby turning every request into a cross-domain request when it was going to the same site.

    @georgestephanis Thanks for the response. I’m already using the most recent version of the Domain Mapping plugin. When connecting, and it asks for the domain, I’ve tried using both the mapped domain and the unmapped domain, as the admin URL is the unmapped. Both result in the same error. Jetpack speaks just fine to the site at WordPress.com. But not in the dashboard and it’s preventing other users from connecting.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Domain Mapping Connect Issue’ is closed to new replies.