Bug in Appengine with COOKIE_DOMAIN
-
When set up as a subdomain install, Google Appengine does some funkiness with pseudo 2nd level subdomains because of SSL certs. Instead of adding a subdomain like subsite.mainsite.appspot.com you have to address it like subsite-dot-mainsite.appspot.com. The default wordpress COOKIE_DOMAIN in this case would be .mainsite.appspot.com. Since I am trying to access the non-mapped hostname, I get a cookie error. since my domain does not match the cookie domain.
When I try to resolve this via define(‘COOKIE_DOMAIN’, ”), sunrise.php gives me an error about COOKIE_DOMAIN being defined. From what I can tell, this check is not needed unless you find a valid $domain_mapping_id.
By moving the following condition
if ( defined( 'COOKIE_DOMAIN' ) ) { die( 'The constant "COOKIE_DOMAIN" is defined (probably in wp-config.php). Please remove or comment out that define() line.' ); }into the block where we find a $domain_mapping_id, this issue is resolved without affecting the plugin.
This is the diff containing the bugfix for appengine multisite
diff --git a/wp-content/sunrise.php b/wp-content/sunrise.php index a7593fe..f64addf 100644 --- a/wp-content/sunrise.php +++ b/wp-content/sunrise.php @@ -2,10 +2,6 @@ if ( !defined( 'SUNRISE_LOADED' ) ) define( 'SUNRISE_LOADED', 1 ); -if ( defined( 'COOKIE_DOMAIN' ) ) { - die( 'The constant "COOKIE_DOMAIN" is defined (probably in wp-config.php). Please remove or comment out that def -} - // let the site admin page catch the VHOST == 'no' $wpdb->dmtable = $wpdb->base_prefix . 'domain_mapping'; $dm_domain = $wpdb->escape( $_SERVER[ 'HTTP_HOST' ] ); @@ -19,6 +15,9 @@ $wpdb->suppress_errors(); $domain_mapping_id = $wpdb->get_var( "SELECT blog_id FROM {$wpdb->dmtable} WHERE {$where} ORDER BY CHAR_LENGTH(domain) $wpdb->suppress_errors( false ); if( $domain_mapping_id ) { + if ( defined( 'COOKIE_DOMAIN' ) ) { + die( 'The constant "COOKIE_DOMAIN" is defined (probably in wp-config.php). Please remove or comment out that de + } $current_blog = $wpdb->get_row("SELECT * FROM {$wpdb->blogs} WHERE blog_id = '$domain_mapping_id' LIMIT 1"); $current_blog->domain = $_SERVER[ 'HTTP_HOST' ]; $current_blog->path = '/';
The topic ‘Bug in Appengine with COOKIE_DOMAIN’ is closed to new replies.