WordPress.org

Make WordPress Core

Opened 6 years ago

Last modified 2 years ago

#35912 new enhancement

Allow changing network URL scheme

Reported by: rmccue Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Networks and Sites Keywords: has-patch 2nd-opinion https
Focuses: multisite Cc:

Description

Right now, it's not possible to convert a network from HTTP to HTTPS. The normal way to enforce HTTPS on a site is to change the URLs for the site, but with multisite, this has to be done via the Network Admin. However, the URL isn't editable at all for the main site on the network, so it's not possible to edit it.

Attached patch allows setting only the scheme for the main site. However, this does have a big question attached: should updating the scheme for the network update it across all sites? If so, should it only update from HTTP -> HTTPS, or vice versa as well?

Attachments (1)

35912.diff (1.9 KB) - added by rmccue 6 years ago.
Add scheme input field for main site

Download all attachments as: .zip

Change History (11)

@rmccue
6 years ago

Add scheme input field for main site

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


6 years ago

#2 @rmccue
6 years ago

  • Keywords has-patch 2nd-opinion added

#3 in reply to: ↑ description @BinaryKitten
6 years ago

Replying to rmccue:

Attached patch allows setting only the scheme for the main site. However, this does have a big question attached: should updating the scheme for the network update it across all sites?

could the option be available to switch schema for any site (maybe in site edit?)

If so, should it only update from HTTP -> HTTPS, or vice versa as well?

definitely should offer switch between 2. Especially helpful for coming from live to dev environment where you don't have HTTPS

#4 @ocean90
6 years ago

Related: #14172

#5 follow-up: @johnjamesjacoby
6 years ago

I have a hunch we can't get away with this as easily as the first patch suggests. I'm thinking of places like site-search that use the root domain & path for relative site look-ups. Are there any other places (maybe the by_path() functions) where this would allow outright breaking of things without warning?

#6 @kraftbj
6 years ago

should updating the scheme for the network update it across all sites?

Generally, I'd say yes, but in cases of subdomain multisite when the server does not have a wildcard cert, this would cause issues.

#7 in reply to: ↑ 5 @rmccue
6 years ago

Replying to BinaryKitten:

could the option be available to switch schema for any site (maybe in site edit?)

You can already edit the URL here for any non-main site; after this patch, the scheme will be editable for all sites, rather than just non-main sites.

Replying to johnjamesjacoby:

I have a hunch we can't get away with this as easily as the first patch suggests. I'm thinking of places like site-search that use the root domain & path for relative site look-ups. Are there any other places (maybe the by_path() functions) where this would allow outright breaking of things without warning?

Neither get_site_by_path() or get_network_by_path() use the scheme; I can't think of any other lookups that would vary based on the scheme. I think it's reasonably safe to update.

#8 @jeremyfelt
6 years ago

In general, I think we should allow the address of the main site to be changed as we do with non-main sites. There are sticky situations to think through. :)

  • In site-info.php, scheme is already a guess because we don't track it in wp_blogs yet use the domain and path from wp_blogs to populate the (now in trunk) "Site Address (URL)" field. We use the scheme attached to the site's siteurl option as our best guess.
  • When updating the address from site-info.php on a non-main site, we change the siteurl and/or the home options IF the previously set domain and path matched exactly. We then overwrite whatever the scheme was with the one entered manually in the text field.
  • Therefore... if we allow only the scheme to be updated on the main site's site-info.php, we would only be able to correctly guess that the scheme should be updated for siteurl or home if domain and path are an exact match.

We've had some brief discussions around tracking scheme in wp_blogs more officially so that we wouldn't have to rely on home and siteurl. One of the concerns was essentially how those options can already be filtered, so setting the scheme separately just moves the problem around a bit.

I guess the short version IMO: If we're going to allow scheme to be updated in this field, we should just treat the main site the same as other sites in site-info.php.

To the secondary point - I don't think we would ever have enough information here to be able to change the scheme network wide in a subdomain installation. It's possible that we could in a subdirectory installation, though how do you enforce that with home and siteurl set separately for all #### sites in the network?

#9 @johnbillion
6 years ago

  • Keywords https added

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


5 years ago

Note: See TracTickets for help on using tickets.