WordPress HTTPS (SSL)
wp-admin redirect to wp-login broken with non-default SSL host (4 posts)

  1. Sentynel
    Posted 2 years ago #

    I use CloudFlare on my site and I don't trust proxying SSL traffic via them, so I have my site set up to serve HTTP on http://www.example.com and HTTPS on secure.example.com. If the login form is forced onto HTTPS, then requesting http://www.example.com/wp-admin/ attempts to redirect to https://www.example.com/wp-login.php, which obviously fails.

    I have a redirect configured in my webserver which sends http://www.example.com/wp-admin/* to https://secure.example.com/wp-login.php?redirect_to=https%3A%2F%2Fsecure.example.com%2Fwp-admin%2F&reauth=1, which mostly solves the issue, but it'd be handy if this was handled correctly by WordPress HTTPS.


  2. Sentynel
    Posted 2 years ago #

    Of course, I've just realised that my workaround doesn't work if you request the secure /wp-admin/ while not logged in, because that still sends you to the www URL for the login page, and thus breaks. This needs fixing in the plugin.

  3. Sentynel
    Posted 2 years ago #

    Workaround: I added a filter on 'wp_redirect' that just does a str_replace for 'https://www.example.com' to 'https://secure.example.com'. I did have a go at working out which function from WordPress HTTPS I should be calling, but the ones I tried didn't quite do what I expected.

  4. Sentynel
    Posted 2 years ago #

    Okay, after further debugging, there's a bug with the makeUrlHttps function. I haven't tried to debug it fully because the function is huge and there's no obvious trigger (for example, some scripts included on pages are broken, but some others work properly). I just have the following workaround inserted before the return statement in that function and everything is now working correctly (including the redirect to wp-login):
    $string = str_replace('https://www.example.com', 'https://secure.example.com', $string);

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WordPress HTTPS (SSL)
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.