Forums

WordPress SSL and reverse proxy. Redirection error (1 post)

  1. diblur
    Member
    Posted 10 months ago #

    I have a web that have to run behind a reverse proxy, and the login and administration panel must be under SSL

    Proxy url: http://example.com
    Real url: http://example-prep.com (where wordpress is installed)

    Everything works ok, but when i try to access administration panel using http://example.com/wp-admin or http://example.com/wp-login.php it redirects to https://example-prep.com/wp-login.php (I have FORCE_SSL_LOGIN and FORCE_SSL_ADMIN activated),so the proxy doesn't recognize the direction and firefox returns server not found error.

    I think the problem is in wp-login.php with the value returned by HTTP_HOST

    // Redirect to https login if forced to use SSL
    if ( force_ssl_admin() && !is_ssl() ) {
    if ( 0 === strpos($_SERVER['REQUEST_URI'], 'http') ) {
    wp_redirect(preg_replace('|^http://|', 'https://', $_SERVER['REQUEST_URI']));
    exit();
    } else {
    wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
    exit();
    }
    }

    Is there any solution to force wordpress to take the proxy url instead the real url like it must be?

    Thanks

Reply

You must log in to post.

About this Topic

Tags