• Resolved brokkr

    (@brokkr)


    I have Jetpack installed on two multisites networks. On each network the same setup applies:

    • All plugins (including Jetpack) are network enabled, so the plugin setup is the same for all sites
    • There is one site on the main domain (mysite.net) and one on a subdomain (sub.mysite.net)
    • Both sites are linked to the same WordPress.com account in Jetpack (also applies across networks)

    On the subdomain-site on both of these networks I am currently seeing the following error message whenever I try to enable any part/feature of Jetpack (the message displays slightly differently in Firefox and Chrome):

    Firefox:
    [X] failed to activate. TypeError: NetworkError when attempting to fetch ressource

    Chrome:
    [X] failed to activate. TypeError: Failed to fetch

    Where X is Carousel/Photon/etc. I get the same message for all attempted features.

    The sites on the main domains – which due to network activation have the exact same plugin setup as the problem sites – do not have this problem. I am able to enable features without errors.

    Under Network admin / JP / Settings, ‘Sub-site overrides’ are checked (allowed) on one of the networks but not the other. Under Network admin / JP / Sites, the scenario is the same, though: Only the problem site is listed and the interface only allows for connect/disconnect actions, not add/remove ones. Despite this Jetpack shows up just fine in the admin of the non-problem sites. Using either the Network admin / JP / Sites administration or the problem-site’s own JP settings I can connect/disconnect to WordPress.com all I want. It does not resolve the issue.

    My current WordPress install started out as 4.5 back in April of last year and has been updated regularly ever since, most recently to 4.7. I probably haven’t tried enabling new JP features since the initial install so I can’t say when in the intervening time this started happening. Jetpack version is 4.4.2. OS is Ubuntu 16.04, php is 7.0.8.

Viewing 12 replies - 1 through 12 (of 12 total)
  • Thread Starter brokkr

    (@brokkr)

    Figuring that it might be possible to move all Jetpack admin to the network, I googled ‘Jetpack multisite network activate’ and came across this page which says that if Jetpack is network activated, the JP admin of the ‘primary site’ becomes the admin for the whole network – at least as far as Jetpack’s Protect feature goes.

    Disabling subsite overrides and testing with the Tiled Galleries feature seems to confirm that this does not extend to other parts of Jetpack. The feature appears on the primary site but not on the subdomain sites.

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic 🚀

    Firefox:
    [X] failed to activate. TypeError: NetworkError when attempting to fetch ressource

    Chrome:
    [X] failed to activate. TypeError: Failed to fetch

    It would seem that REST API requests are either blocked or fail on your subsites.

    Could you try to go sub.mysite.net/wp-json/ on one of your sites, and let me know what your see? The results should be similar to this:
    https://jeremy.hu/wp-json

    If that page is available on your site but the requests still fail when trying to activate a module, could you try the following:

    1. Open the dashboard page.
    2. Open your browser console
    3. Click on the Network tab
    4. Refresh the page.
    5. Try to activate a module.
    6. If you see any lines in red inside the browser console, click on them. A new panel should appear on the right.
    7. Click on the “Response” tab in that new panel.
    8. Copy the message displayed there.
    9. Paste it here.
    10. If no red lines appeared in the browser console, click on the “Console” tab of the browser console.
    11. Copy any errors displayed there, and paste them here.

    Thanks!

    Thread Starter brokkr

    (@brokkr)

    Thanks for responding.

    I get 404s on all sites:

    {“code”:”rest_no_route”,”message”:”No route was found matching the URL and request method”,”data”:{“status”:404}}

    This applies to both main site and subsite, e.g.

    I have tried searching for explanations relating to wp-json (I’m assuming here that Jetpack makes use of it somehow now) but have not come upon anything. Some people do mention webser/proxy configuration so it might bear on the matter that I use nginx. I can’t see anything differentiating the sub and main site in the configuration of the server.

    However, there are differences in what appears in the access logs. This is me enabling Tiled galleries on the main site:

    86.52.239.162 - - [12/Jan/2017:21:15:44 +0100] "GET /wp-json/jetpack/v4/site HTTP/1.1" 400 122 "https://brokkr.net/wp-admin/admin.php?page=jetpack" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0"
    192.0.101.132 - - [12/Jan/2017:21:15:46 +0100] "POST /xmlrpc.php?for=jetpack&token=U1bXlkHoiE2WgU%29Sx%4016014Gga%26B%5E0RP%3A1%3A0&timestamp=1484252135&nonce=kitAskjXaU&body-hash=BlirtvkZK6gLGJW6I0aTLi%2FbAbE%3D&signature=uT5hiLqsid5ONdHSuBZZWHKoLoQ%3D HTTP/1.1" 200 669 "https://brokkr.net/xmlrpc.php?for=jetpack&token=U1bXlkHoiE2WgU%29Sx%4016014Gga%26B%5E0RP%3A1%3A0&timestamp=1484252135&nonce=kitAskjXaU&body-hash=BlirtvkZK6gLGJW6I0aTLi%2FbAbE%3D&signature=uT5hiLqsid5ONdHSuBZZWHKoLoQ%3D" "Jetpack by WordPress.com"
    86.52.239.162 - - [12/Jan/2017:21:16:04 +0100] "POST /wp-cron.php?doing_wp_cron=1484252163.8947679996490478515625 HTTP/1.1" 499 0 "https://brokkr.net/wp-cron.php?doing_wp_cron=1484252163.8947679996490478515625" "WordPress/4.7.1; https://brokkr.net"
    86.52.239.162 - - [12/Jan/2017:21:16:05 +0100] "POST /wp-json/jetpack/v4/module/tiled-gallery/active HTTP/1.1" 200 87 "https://brokkr.net/wp-admin/admin.php?page=jetpack" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0"
    

    Clicking the same slider button on the but site produces nothing in the access log.

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic 🚀

    Thanks for the extra details.

    You appear to be using the Comet Cache plugin on your site. Unfortunately, one of the settings of this plugin breaks WordPress’ REST API (usually available via the wp-json URLs you posted above), and consequently breaks all plugins and core WordPress features that rely on the REST API, like Jetpack.

    The Comet Cache plugin authors are aware of the issue and working on a fix. In the meantime, you should be able to solve the issue by disabling the following option in your Comet Cache settings:
    Dashboard → Comet Cache Pro → Plugin Options → Apache Optimizations → Enforce Canonical URLs?

    You can read more about the issue here:
    https://github.com/websharks/comet-cache/issues/855

    I hope this helps.

    Thread Starter brokkr

    (@brokkr)

    Thanks for the suggestion. I feel stupid for not thinking of disabling plugins first.

    Sadly, either that’s not it or somehow the cache is still on despite the plugin being gone. The page source files certainly no longer mention Comet Cache.

    Here’s what I did:

    I am not a (Comet Cache) Pro user so I never had that option to enable. CC Changelog says it’s exclusive to Pro, not ‘lite’. Also not an Apache but an Nginx user so don’t know what impact that would have had, even if.

    In any case if the problem was related to CC, I figured that disabling the plugin should do the trick. It didn’t. Then I reenabled it, wiped the cache, disabled it. Still no go on either /wp-json or Jetpack features. So I deleted the plugin. Nope.

    I disabled all plugins network-wide except Jetpack. Still no difference. Restarted nginx just for good measure. Nah. Switched theme to vanilla twenty sixteen in case there was anything in functions.php in the way. No. Still won’t let enable/disable anything.

    I’m out of ideas :/

    • This reply was modified 7 years, 3 months ago by brokkr.
    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic 🚀

    Thanks for giving that a try.

    Looking at your site right now, it doesn’t seem to be properly connected to WordPress.com anymore. Could you try the following:

    1) Go the Jetpack menu in your dashboard
    2) Click on “Disconnect Site from WordPress.com” at the bottom of the page if your site is currently connected to WordPress.com.
    3) Confirm the disconnection.
    4) Click on the Connect button to connect your site to WordPress.com again.

    Once you’ve reconnected, and with Comet Cache still off, could you then try to activate a module again? If you still experience issues, could you check the Network response in your browser’s console again to see if the error is still the same?

    Let me know how it goes.

    Thread Starter brokkr

    (@brokkr)

    Got it. The connections are being blocked by the browser because of mixed content!

    If I disable Firefox blocking mixed content I’m allowed access but nginx is set to redirect http to https with a 301 so I still get nothing, understandably.

    Now, the question is still why this happens on one set of sites but not on the other. The certificates in question are obviously set in the name of the main domain but apply equally to the subdomains (named, not wildcard).

    Here’s the certificate as represented by digicert’s cert checker:

    Common Name = brokkr.net
    Subject Alternative Names = brokkr.net, games.brokkr.net, sky.brokkr.net
    Issuer = Let's Encrypt Authority X3
    Serial Number = 0335C4899ED2AC8383E4DDDAF3BF797682EE
    SHA1 Thumbprint = AFA557F0E01A01498CF66AA9F96B08CFFE6E48F6
    Key Length = 2048
    Signature algorithm = SHA256 + RSA (excellent)
    Secure Renegotiation: Supported
    Thread Starter brokkr

    (@brokkr)

    Just to clarify what I’m seeing in the console.
    Mixed Content Warning in Firefox when using Jetpack on subdomain

    • This reply was modified 7 years, 3 months ago by brokkr.
    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic 🚀

    That’s interesting. Could you go to Settings > General in your dashboard, and make sure that your WordPress site address is set to use HTTPS? I’m not quite sure how you’re able to navigate your dashboard in HTTPS while having WordPress load resources in HTTP.

    If your WordPress settings appear to be correct, could you check if any of your plugins may change the protocal used to load resources on your site?

    Thread Starter brokkr

    (@brokkr)

    I seem to recall that that settings only applies to non-multisite setups. There aren’t any https options in settings / general, neither in the network settings nor in the individual sites settings. At least, none that I have found.

    I’m not running any plugins on either site at the moment but Jetpack.

    For wwhat it’s worth, I remember that the question of mixed content has come up before. When 4.4 came out about a year ago I and many others had some issues with WP not setting srcset links on images to https while the src attribute was. The solution proposed by developers at the time was to add some code to your theme’s function.php.

    (Thread is here)

    I believe that they have fixed that since, though, and in any case srcset wouldn’t apply to anything here, I’m thinking. Also in switching away from the custom theme as part of the troubleshooting those functions.php alterations are no longer in play. The blog runs on vanilla Twenty Sixteen.

    Could there anything similar at play here?

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic 🚀

    Thanks for the extra details. At this point, I’d recommend that you dig into your network’s database and manually change the home and siteurl values from HTTP to HTTPS there. You’ll find those values in multiple tables, as outlined here:
    https://wpengine.com/support/how-to-change-a-multi-site-primary-domain/

    As long as your replaces instances that currently use http:// to https://, that should solve your problems (and solve that srcset issue at the same time).

    Let me know how it goes.

    Thread Starter brokkr

    (@brokkr)

    That fixed it. Excellent. Thank you so much 🙂

    Just to be specific: It started working as soon as I changed the options in the table allocated to the problem subsite (“[network name]_2_options”). I will obviously change the ‘http://…’ values in the sitemeta and the main site options tables as well, but those values were not the cause of what I was seeing.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Jetpack: NetworkError/’Failed to fetch’ on subdomains in multisite’ is closed to new replies.