Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question
    
I smell that this is very much related to wordpress, would be cool to find out more. –  hakre Feb 8 '11 at 23:41
add comment

2 Answers

up vote 1 down vote accepted

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*/ );
-                }
-        }
share|improve this answer
    
thank you. that worked.. is there something I can do to have it so that this gets into trunk/3.1/3.0.6? –  Vid Luther Feb 9 '11 at 17:29
add comment

that Wordpress error message is probably misleading.

Wordpress looks for the domain name in $_SERVER['HTTP_HOST'] (PHP Manual) and if it contains a port number (separated with : as usual like http://example.com:444/) it will only accept two variants: port 80 an port 443.

I assume that in your varnish configuration other ports are given and so you bump into that one.

I'm no expert with varnish, but that's where I would start to tinker with. First of all I would output that value. File in question is /wp-includes/ms-settings.php, ~ line 38. You can start adding a var_dump($_SERVER['HTTP_HOST']); before the wp_die statement.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.