WordPress.org

Ready to get started?Download WordPress

Forums

wp-login POST to https but http on different port (not port 80) (5 posts)

  1. fruey
    Member
    Posted 2 years ago #

    I have a development server running WordPress and I have it running on a non standard port (8080). I have therefore set the site url to dev.example.com:8080

    The login page makes the redirect to https, so it POSTs to https://dev.example.com:8080 but of course that won't work.

    I would like either:

    - To have login over HTTP only (it's a dev server, so security isn't an issue)
    - Or preferably to have login over https anyway (SSL is running on my dev machine OK) but to not have the port come up as 8080 because that's no good for https.

    I have tried using .htaccess to redirect https URLs but because I'm behind a NAT router that isn't working (maybe my redirect voodoo was wrong though).

    I have tried stopping WordPress from using HTTPS at all but I'm stuck, I saw this page http://wordpress.stackexchange.com/questions/4720/wp-login-php-redirecting-to-https but my user meta table looks OK...

    It seems there is no way to tell WordPress you're on a different port... should I just maybe let WordPress think it's running on port 80 and redirect everything to 8080 from .htaccess instead?

  2. fruey
    Member
    Posted 2 years ago #

    I just realised I have found

    define('FORCE_SSL_LOGIN', true);

    in my wp-config.php file. So I can solve the login over HTTP which now works

    However if I do want to do it over SSL but keep the site on port 8080 I'm going to need to try maybe forcing port 80 to redirect to port 8080 for non SSL traffic.

  3. fruey
    Member
    Posted 2 years ago #

    Hmm I can't work out who to do that redirect because in fact my server will never "see" the port 8080 traffic since it's listening on port 80 but seeing URLs with :8080 on them (NAT + port redirect on router).

    http://dev.example.com:8080 -> port redirect 192.168.0.8:80
    https://dev.example.com -> direct NAT 192.168.0.8:443

    Can I get this to work?

  4. WordPress doesn't really work well over non-port 80s.

    Why can't you use 80?

  5. fruey
    Member
    Posted 2 years ago #

    Just by the way, WordPress works fine on other ports (as long as you don't want to use SSL for logins, so mainly only for dev environments) as long as you set siteurl and home in wp_options to the full URL (including port, e.g. "http://dev.example.com:8080"). Tested on WP 3.3.1

Topic Closed

This topic has been closed to new replies.

About this Topic