[wp-trac] [WordPress Trac] #21077: Add support for custom ports in multisite site addresses

WordPress Trac noreply at wordpress.org
Sun Feb 21 15:35:22 UTC 2021


#21077: Add support for custom ports in multisite site addresses
------------------------------------------+-----------------------------
 Reporter:  djzone                        |       Owner:  (none)
     Type:  enhancement                   |      Status:  reopened
 Priority:  normal                        |   Milestone:  Future Release
Component:  Bootstrap/Load                |     Version:  3.4
 Severity:  normal                        |  Resolution:
 Keywords:  needs-patch needs-unit-tests  |     Focuses:  multisite
------------------------------------------+-----------------------------

Comment (by spacedmonkey):

 I think the question is, do we officially support custom ports, add a
 input when you register a site and save the port number somewhere ( site
 meta ). Then change bootstrap to support any port.

 Or do we just give enough filters and hooks to enable developers to add
 support themselves, similar to domain mapping.

 I would recommend the second course and I would even write a drop in /
 plugin to allow developers to do this.

 I think that the current patch
 [https://core.trac.wordpress.org/attachment/ticket/21077/15936.5.diff
 15936.5.diff] does solve this problem and does allow developers to do what
 they want.

 Currently to add a custom port, you would have to add a sunrise.php and
 then add a filter that looks like this.

 {{{#!php
 add_filters('allowed_multisite_ports', function( $current ){
   $current[] = ':81';

   return $current;
 });

 }}}

 I think we would also need something in the bootstrap to looks up the site
 via a port.

 This is work of course, but is not exactly use friendly. Maybe instead of
 filter, we could do with a PHP const.

 {{{#!php
 define( 'WP_ALLOWED_PORTED', '80, 443' );
 }}}

 Once noting that not really good idea to have an array value of a const.
 So we could just use
 [https://developer.wordpress.org/reference/functions/wp_parse_list/
 wp_parse_list].

 So when we use it, would looks like this.
 {{{#!php
  $allowed_ports = wp_parse_list( WP_ALLOWED_PORTED );
 }}}


 Thoughts @jeremyfelt @johnjamesjacoby

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/21077#comment:20>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list