Siteurl resets to default GCP external address when the instance is stopped/restarted

Keywords: WordPress Multisite - Google Cloud Platform - Technical issue - Other
bnsupport ID: 88feb93f-8296-0759-9efb-6382bd7c1631
Description:
I try to avoid this as much as possible because it’s a pain in the butt to fix, but sometime’s its unavoidable if the server crashes.

If the VM instance is stopped for any reason and restarted, values in the mysql database pertaining to the site url are automatically reset to defaults. Is there something in the bitnami Start services or boot up that is causing this?

Affected Values
Database: Bitnami_wordpress
Table: wp_blogs
domain value on site 1 (blog_id = 1) is reset to google default external url, something like 34.XXX.XX.xo.com

Table: wp_options
siteurl and home both reset to same default external address

Table:wp_site
Domain value reset to default external address

I should note that this is a multisite and sites 2 and 3 are not affected in any way as far as I can tell.

I wondered if it was a wordpress issue, but because this only happens at the stop/start of the VM it suggests that it’s deployment specific. I don’t see how wordpress would be able to find and populate the default google external address into it’s tables.

It’s almost like restarting the instance is performing some part of the deployment process when it first initialized.

Please advise.

Hi @dahr.chan,

You need to disable the bnconfig tool. If not disabled it will reconfigure the application URL every time the IP address changes. You can disable it by renaming it:

mv /opt/bitnami/apps/wordpress/bnconfig /opt/bitnami/apps/wordpress/bnconfig.disabled

After that you need to configure the WordPress domain:

https://docs.bitnami.com/aws/apps/wordpress-multisite/configuration/configure-wordpress-multisite/

Regards,
Michiel

Regards,
Michiel

Thanks, that worked.

Had to do another reset and it looks like this time my settings were preserved.

I’m having cookie issues though, I keep getting the reauth login while I navigate certain parts of the admin portal. It’s more noticeable on the network admin pages.

I tried clearing my local cookies and cache but that doesn’t fix it. If I manually enter in URLs I want to go to like /wp-admin/network/plugins.php then I’ll get a login screen without a math challenge and it will work. If I navigate a few pages eventually it sends me back to reauth with a math challenge that fails every time.

I also tried the troubleshooting bits in my wp-config
# start: fixes for cookies issues with multiple domains
define( ‘COOKIE_DOMAIN’, ‘’ );
define( ‘ADMIN_COOKIE_PATH’, ‘/’ );
define( ‘COOKIEPATH’, ‘/’ );
define( ‘SITECOOKIEPATH’, ‘/’ );
# end: fixes for cookies issues with multiple domains

with and without the / under admin_cookie path, but the problem still persists. Is there anything I can look at like console logs to help troubleshoot this? Not sure if it’s cookie path configuration or perhaps siteurl definitions are wrong somewhere.

Hi @dahr.chan,

Did you add these lines right after BLOG_ID_CURRENT_SITE?

  # start: fixes for cookies issues with multiple domains
  define( 'COOKIE_DOMAIN', '' );
  define( 'ADMIN_COOKIE_PATH', '/' );
  define( 'COOKIEPATH', '/' );
  define( 'SITECOOKIEPATH', '/' );
  # end:   fixes for cookies issues with multiple domains

Regards,
Michiel

I did. Eventually the issue resolved itself. I’m not exactly sure why. I had reset my local cache and cookies so many times with it persisting and also switched my CDN to developer mode to skip it’s caching as well (not that it should be caching any wp-admin pages anyways).

Is session/cookie data stored anywhere else? I’m guessing whatever residual session information expired.

Even though the problem is resolved, I’d still like to know root cause. This is the third time I’ve had to deal with this particular cookie issue over the time I’ve been running this deployment. I’m hoping it’s the last now that I’ve put the server on a static IP instead of ephemeral and disabled the bnconfig. Praying my settings don’t get reset again.

Hi @dahr.chan,

I suspect it’s due to the cloudfront caching. It can take a while for the changes to be updated.

Regards,
Michiel

I agree. Even though I put it into dev mode and it shouldn’t be serving cached pages, I can’t think where else session data issues would be coming up if local data is already wiped. The fact that it eventually expired supports this too.

The annoying thing is that I suspect it was only my session affected since I’m the only one that accesses the network admin. I didn’t hear any reports of any other users having issues. My staff might have on a different part of the admin backend but I believe just clearing their local cache/cookie was sufficient.

Anyways, thanks for the assistance!

damn, as soon as I replied and tried to login again I was having issues.

I think it has something to do with accessing the network admin from other parts of the multisite.
If i’m in the admin console for site one and go to the top nav bar > My Sites > Network Admin > Plugins
it forces me to the reauth login page with the math challenge, even though I’m signed in and looking at that page on another tab.

To get there otherwise I have to type in the actual URL of that page directly into my address bar, which still forces me to login again but it doesn’t do the math challenge and is successful.

Once i’m on the network admin I’m fine navigating pages within it.

It’s not just the network admin, seems like it’s whenever I try to navigate between dashboards of different sites as well.

Hi @dahr.chan,

Can you try to disable pagespeed?

https://docs.bitnami.com/bch/apps/wordpress/administration/use-pagespeed/#disable-pagespeed

Regards,
Michiel

I had already disabled that a few weeks ago. It was giving me just lots of fetch fail errors and when I posted about it in this thread, they recommended I turn it off and switch to a wordpress plugin based caching instead.

I’m currently using WP-Optimize for caching now, but it’s also giving me php errors like:

AH01071: Got error 'PHP message: PHP Fatal error: Uncaught Error: Call to undefined function __() in /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/wp-optimize/cache/file-based-page-cache-functions.php:28\nStack trace:\n#0 [internal function]: wpo_cache('', 9)\n#1 {main}\n thrown in /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/wp-optimize/cache/file-based-page-cache-functions.php on line 28'

I have another open thread on their support forum, but so far the only response was to also check for conflicting caching services, which are already off.

Hi @michiel,

That error seems due to a wrong piece of code in the plugin. Did you try turning off WP-Optimize?

wp plugin deactivate PLUGINNAME

Regards,
Michiel

Yeah, I can disable the plugin reporting that particular error, but that doesn’t solve either problem. I want local caching and pagespeed was giving me just as many errors (if not worse errors). I’m hoping to resolve the source of that particular error with the plugin developer. Disabling the plugin didn’t solve the reauth issue anyways.

It still logs me out whenever any of the admin users try to use the network navigation dropdown.

If we type in the URL (eg: https://www.makercube.ca/wp-admin/network/plugins.php) directly to any of the sites it resets it or something in such a way that we still have to login but it doesn’t do the math challenge. If it does the math challenge it just automatically fails every attempt.

I noted that when I type in the URL directly it changes it to
https://www.makercube.ca/wp-login.php?redirect_to=https%3A%2F%2Fwww.makercube.ca%2Fwp-admin%2Fnetwork%2Fplugins.php&reauth=1

but if I try using the navigation menu it goes to:
https://www.makercube.ca/wp-login.php?redirect_to=https%3A%2F%2Fmakercube.ca%2Fwp-admin%2Fnetwork%2Fplugins.php&reauth=1

I’m not sure if it matters that it’s missing the ‘www’ in the redirect address.
If that is the cause then I suspect it’s missing from one of the siteurl definitions in the database, though i’m not sure which one. I vaguely recall having it and not having it was important for particular entries.

I’ll just post my configuration:

wp-config.php:
define( ‘DOMAIN_CURRENT_SITE’, ‘makercube.ca’ );

Mysql tables:
wp-options:

wp-blogs:

wp-site:

wp-sitemeta:

If i had to guess, probably the wp-blogs or the wp-site table? They’re the only places where I don’t know what the expected value format should be. I’m pretty sure wp-config domain_current_site should not have prefixes.

Just a quick note. I still have wp-optimized disabled and I got another php error.

[Thu Mar 25 13:25:51.163512 2021] [proxy_fcgi:error] [pid 1995:tid 139858672436992] [client 172.70.35.20:46060] AH01071: Got error 'PHP message: PHP Fatal error: Uncaught Error: Class 'getid3_handler' not found in /opt/bitnami/apps/wordpress/htdocs/wp-includes/ID3/module.audio.ac3.php:18\nStack trace:\n#0 {main}\n thrown in /opt/bitnami/apps/wordpress/htdocs/wp-includes/ID3/module.audio.ac3.php on line 18'

Which seems totally unrelated but I thought i’d mention in case it was.

Hi @dahr.chan,

I see that in each table it’s a different domain:

In wp-sitemedia the domain is with www. In the others it’s without www. Could you change the siteurl in wp-sitemedia to the non www domain, and also to https instead of http? Did you also configure DOMAIN_CURRENT_SITE in the wp-config.php file to your domain?

Regards,
Michiel

Ah that seemed to have fixed it.

I removed the www from siteurl in the wp-sitemeta table and from both entries (siteurl & home) in the wp-options table.

It still required me to login on each site once despite being logged into the network admin which was weird imo, but I think once the session was saved then I didn’t have to re-login. I’ll have to give it some time to see if the sessions expire individually per site or what.

For now, the issue that was repeatable is resolved.

Thanks!

1 Like

Hi @dahr.chan,

I’m glad to hear you’ve solved the issue. Thanks for sharing it. :smile:

Regards,
Michiel