Roots Discourse

Issue with Multisite + Gutenberg

I have not – I can’t see how anyone can use the customizer on a multisite with trellis, though I am likely doing something wrong

Just to confirm, everything else with this install seems to work? It’s only an issue with Gutenberg posts?

And then the customizer issue is separate?

Am I doing anything wrong? I’d like to stay as close to the right way of using Trellis as possible…

Doesn’t look like it but honestly I don’t have much experience with multisite on Trellis myself

How can I get the customizer to work?

The most likely answer is there’s a bug somewhere… I’m not really much help though :frowning_face:

Can you check/post the contents of the generated .env file (on your VM/server in the web root).

Yes, I’m sorry the two get a bit conflated here, but I did not want to flood with new topics. So, breaking down the two issues here, which are potentially related:

“Out of the box” using the install that I describe above, neither Gutenberg, nor the customizer work.

Gutenberg:

A temporary bandaid fix for Gutenberg is adding a 301 redirect for :

/wp/wp-admin/post.php* to /wp-admin/post.php*
/wp/wp-admin/post-new.php* to /wp-admin/post-new.php*

Customizer:

I tried the same style fix for customizer, i.e. adding a redirect for the Customizer

/wp/wp-admin/customize.php?return=%2Fwp%2Fwp-admin%2Fedit.php to /wp-admin/customize.php?return=%2Fwp%2Fwp-admin%2Fedit.php

I get the same results as if I do not redirect


In my trellis built server here is my .env

AUTH_KEY='{redacted}'
AUTH_SALT='{redacted}'
DB_HOST='localhost'
DB_NAME='manage_matgargano_com_production'
DB_PASSWORD='{redacted}'
DB_USER='{redacted}'
DISABLE_WP_CRON='True'
DOMAIN_CURRENT_SITE='manage.matgargano.com'
LOGGED_IN_KEY='{redacted}'
LOGGED_IN_SALT='{redacted}'
NONCE_KEY='{redacted}'
NONCE_SALT='{redacted}'
SECURE_AUTH_KEY='{redacted}'
SECURE_AUTH_SALT='{redacted}'
WP_ENV='production'
WP_HOME='https://manage.matgargano.com'
WP_SITEURL='https://manage.matgargano.com/wp'

You can recreate my issue using the repo I am using https://github.com/matgargano/multisite

or I can easily give you access to everything, feel free to message me on slack and then whatever the solution is that we get to I will summarize for the rest of the community.

1 Like

any thoughts here? I may have to abandon MU for client sites if this is an issue. This would really neatly allow me to host multiple client sites on the same server.

There’s a 100% chance this can be fixed.

I currently don’t have the free time to look into this myself.

@mgargano I think I’m experiencing this issue as well. I’ll report back with my findings.

@knowler :+1: I am at a loss at this point.

The solution seems to be as simple as setting the following in config/application.php:

Config::define('COOKIE_DOMAIN', $_SERVER['HTTP_HOST']);

For me the issues had to do with the nonce cookie not being able to verify since the sub-site domain was different than the cookie domain. I was having difficulty with Gutenberg and a multisite using custom domains for sub-sites. So I don’t know if this will work for your issue.

This does not work in my configuration.

Can you test if this works for your Customizer?

Also can you post your application.php

mine is: https://gist.github.com/matgargano/9813288f59d803ec57d5a767dd50419c

Customizer seems to work fine. Here’s my Bedrock config:

https://gist.github.com/knowler/3727742a753cdd34750895c8303c259c

OK Few things —

First and foremost : https://gist.github.com/knowler/3727742a753cdd34750895c8303c259c#file-application-php-L102 any issue with the single colon? I’ve literally never seen that in PHP

Do you have all subdirectories? subdomains? Do you have any TLD mapped domains?

Thanks for the assistance so far…

Ok some more things…

If I use a subdomain, e.g. manage.matgargano.com and multisite.matgargano.com i am able to do everything without any issue.

if i map to a separate domain (foobar.com) that’s when i have the issue… still digging further…

My bad that’s a syntax error.

I have mapped domains with a subdomain setup.

Have you tried mapping TLDs and not subdomains? If not- can you? I can supply the domain if you need one.

Something isn’t adding up… likely something I’m doing. Would you want to walk through the whole process with trellis and bedrock with me to see where I’m possibly doing something wrong.

-Mat

@knowler any update here?

See this:

I can’t believe that was it !?

seems to work, need to do more testing

1 Like

OK, so I tried just wholesale replacing my application.php with your application.php

I still have the same issue

After Config::apply() I error_log out COOKIE_DOMAIN and it is in fact the right domain (the current domain I am on).

Any idea how to further troubleshoot?

one other thing to note is that wp_blogs has mydomain.com (the same domain set to COOKIE_DOMAIN above) and wp_3_options has siteurl = mydomain.com and home = mydomain.com/wp (i even tried changing home to = mydomain.com (without /wp) and still didnt work