Multisite behind Varnish

I’m trying to use varnish with a wp 3.0.5 site with Network (Multisite), when I access the varnish URL, I get this message:

Multisite only works without the port number in the URL.

Do I need a custom VCL to make this work? I’m using the same backend config for other wordpress sites that work fine..

If I need to ask this on serverfault, let me know and I’ll ask there.

2 Answers
2

I found a fix here: http://core.trac.wordpress.org/ticket/15936

You basically need to modify wp-includes/ms-settings.php like this (remove ‘-‘ lines; add the ‘+’ line):

@@ -26,18 +26,8 @@
  if ( !isset( $current_site ) || !isset( $current_blog ) ) {
+        $_SERVER['HTTP_HOST'] = preg_replace( '|:\d+$|', '', $_SERVER['HTTP_HOST'] );
         $domain = addslashes( $_SERVER['HTTP_HOST'] );
-        if ( false !== strpos( $domain, ':' ) ) {
-               ....
-                        wp_die( /*WP_I18N_NO_PORT_NUMBER*/'Multisite only works without the port number in the URL.'/*/WP_I18N_NO_PORT_NUMBER*/ );
-                }
-        }

Leave a Comment