WordPress.org

Make WordPress Core

Opened 4 years ago

Last modified 5 months ago

#36323 new defect (bug)

home_url returns url with wrong scheme

Reported by: Gerkin Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.4.2
Component: Permalinks Keywords: https dev-feedback
Focuses: multisite Cc:
PR Number:

Description

Hello,

I have a multisite with HTTPS on all subsites. When using

home_url( '/' );

, on a subsite page, logged in user got a https url, when anonymous got just http.

In the track, it seems that the error comes from those lines...

2963            if ( ! in_array( $scheme, array( 'http', 'https', 'relative' ) ) ) {
2964                    if ( is_ssl() && ! is_admin() && 'wp-login.php' !== $pagenow )
2965                            $scheme = 'https';
2966                    else
2967                            $scheme = parse_url( $url, PHP_URL_SCHEME );
2968            }

...

Thank you for your time.

Change History (4)

#1 @johnbillion
4 years ago

  • Keywords https reporter-feedback added

Thanks for the report, @Gerkin.

How are you implementing HTTPS on your site? WordPress core doesn't vary the home URL scheme depending on whether or not a user is logged in, so there must be something else affecting its return value, such as a plugin on your site that's filtering the value.

  • How are you implementing HTTPS URLs on your subsites?
  • Do you have a plugin on your site which is filtering the home URL return value?
  • Are you using domain mapping?
Last edited 4 years ago by johnbillion (previous) (diff)

#2 @Gerkin
4 years ago

Hello,
I'm using the plugin "WordPress HTTPS" to force all URLs become SSL encrypted. wp-config.php was also modified to enable SSL.

What do you mean by "Domain mapping"?

Thank you

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


3 years ago

#4 @flixos90
3 years ago

  • Keywords dev-feedback added; reporter-feedback removed
Note: See TracTickets for help on using tickets.