Make WordPress Core

Opened 12 years ago

Closed 9 years ago

Last modified 8 years ago

#21153 closed enhancement (wontfix)

supporting protocol-relative urls

Reported by: nagyv's profile nagyv Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.3.2
Component: General Keywords: close
Focuses: Cc:

Description (last modified by SergeyBiryukov)

changing http:// and https:// generated links to // links would easily add support for hosting a site both under http and https easily

one place I've found this to be changed is in wp-includes/link-template.php around line 2006

the first if could be changed to:

$url = str_replace( "https://", "//", $url)
$url = str_replace( "http://", "//", $url)

Attachments (1)

21153.patch (609 bytes) - added by nagyv 12 years ago.
a git diff

Download all attachments as: .zip

Change History (14)

@nagyv
12 years ago

a git diff

#1 @georgestephanis
12 years ago

I don't think you're tracing the code far back enough ... WP_CONTENT_URL is defined partially off of get_option( 'siteurl' ); -- which currently requires there to be a http:// or https://

Your best option with this may be to enable defining that as example.com rather than http://example.com or https://example.com

Version 0, edited 12 years ago by georgestephanis (next)

#2 @lkraav
11 years ago

@georgestephanis, there is no ticket for home and siteurl protocol relative options, correct? If not, I think that's the core issue and this ticket should be retargeted to solving it.

3.9 still doesn't let me set addresses as //domain.com

Last edited 11 years ago by lkraav (previous) (diff)

#3 @SergeyBiryukov
10 years ago

  • Description modified (diff)

#4 @SergeyBiryukov
10 years ago

#29768 was marked as a duplicate.

#5 @SergeyBiryukov
10 years ago

  • Milestone changed from Awaiting Review to 4.1

The issue is that sanitize_option() specifically requires http(s?)://.

#6 @SergeyBiryukov
10 years ago

Looks like changing the regex in sanitize_option() is not enough:

  1. If you set home and siteurl to a relative URL, you can no longer log in.
  2. Links are still generated with http://.

#7 @SergeyBiryukov
10 years ago

  • Milestone changed from 4.1 to Future Release

#8 @chriscct7
9 years ago

  • Keywords needs-patch added

#9 @SergeyBiryukov
9 years ago

#35814 was marked as a duplicate.

#10 @ericlewis
9 years ago

  • Keywords close added; needs-patch removed

A WordPress site should either be configured to serve HTTP or HTTPS, the protocol relative URL is an anti-pattern.

We should review our HTTPS setup documentation and see if it can be improved.

#11 @johnbillion
9 years ago

  • Milestone Future Release deleted
  • Resolution set to wontfix
  • Status changed from new to closed

#12 @jorbin
9 years ago

#37108 was marked as a duplicate.

#13 @SergeyBiryukov
8 years ago

#39846 was marked as a duplicate.

Note: See TracTickets for help on using tickets.