WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. diblur
    Member
    Posted 2 years 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

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags