WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 2 years ago

#42993 closed enhancement (duplicate)

WordPress Multisite: Allow for different ports

Reported by: Blackbam Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.0
Component: Networks and Sites Keywords: has-patch
Focuses: multisite Cc:
PR Number:

Description

The WordPress Codex says it is not possible to run WordPress on a different Port than Port 80 or Port 443. In times of Docker and complex development environment setups this is a real pain in the ass. Furthermore there are some common ports like 8080 which are not unusual for a webserver to use.

Please lets get rid of this completely unnecessary restriction on WordPress network installations. The following solutions seems to describe which parts of the Core have to be adapted:

https://benohead.com/wordpress-running-multisite-different-port/
https://wordpress.stackexchange.com/questions/212978/multisite-network-port-num-issues

Maybe there are one or to more things which must be changed, in order to get it to work properly.

Attachments (2)

42993.patch (3.1 KB) - added by enrico.sorcinelli 2 years ago.
42993.2.patch (4.0 KB) - added by enrico.sorcinelli 2 years ago.
This patch replace previous one

Download all attachments as: .zip

Change History (7)

#1 @johnbillion
2 years ago

  • Keywords needs-patch added
  • Type changed from enhancement to feature request
  • Version changed from trunk to 3.0

#2 @enrico.sorcinelli
2 years ago

  • Keywords has-patch added; needs-patch removed
  • Type changed from feature request to enhancement

I was opening a similiar ticket for a patch I made for this.

The proposal patch adds allowed_multisite_ports new filter that allows to define differents ports in Multisite installs other than 80 and 443. For example:

add_filter( 'allowed_multisite_ports', function( $ports ) {
	$ports[] = ':8000';
	return $ports;
} );

I thought it was better to explicitly add differents ports instead of allow differents ports by default (or by defining constant like define( MULTISITE_ALLOW_DIFFERENT_PORTS, true )).

PS: Currently I used filter for sanitize_user() (used in wpmu_create_blog()) in order to allow ports in domain string, even if the best way would be to add a sanitize_domain() dedicated function since the first one allows also underscores.

@enrico.sorcinelli
2 years ago

This patch replace previous one

#3 @enrico.sorcinelli
2 years ago

I just updated the patch also in order to maintain ports when editing site info ( Site Address (URL) ).

This ticket was mentioned in Slack in #core-multisite by enrico.sorcinelli. View the logs.


2 years ago

#5 @jeremyfelt
2 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Thanks for the ticket @Blackbam and thanks for the patch @enrico.sorcinelli.

I'm going to close this out as a duplicate of #15936. The focus on IPv6 in that ticket is a little different, but goes hand in hand with arbitrary custom port numbers.

That ticket looks old and unfriendly, but I don't think anything is really holding it up more than a lack of activity. Please chime in with comments and patches there!

Note: See TracTickets for help on using tickets.