Domain mapping redirect loop (302) between http and https

Hi

I create a subdomain for my multisite and then map a domain.

let say i create
sub.maindomain.com

and using domain mapping i map seconddomain.com to sub.maindomain.com

if i go to seconddomain.com using chrome or firefox (i clean cookie/cache so on first), it will be loop between http and https with error 302.

but if i use other browser such chromium it fine except i accessing https://seconddomain.com it will go to a message "this webpage has a redirect loop". and after that http://seconddomain.com will also got "this webpage has a redirect loop" until i clear all cookie.

my suspect is cookie problem but i can not found anywhere how to solve this problem.
anyone can help me ?

thank you and regards

  • Patrick
    • Support Monkey

    Hi there @mprasodjo

    I hope you're well today!

    I see this is related to your other support thread here:
    https://premium.wpmudev.org/forums/topic/second-domain-do-not-want-to-go-to-https

    ...where you had determined the issue is only happening on mapped domains. Thanks for creating a new thread for the issue.

    Unfortunately, this is not really my area of expertise, and I believe we'll need a bit more experienced help here than I can provide. Perhaps my colleague @Jack Kitterhing could provide some better insight into this issue?

    What say you Jack?

  • mprasodjo
    • Design Lord, Child of Thor

    Thank you for your respon Patrick, and hope you well too.

    yes it related, i was try to close that threat and not found a solved button.
    this threat have a solved button.

    my first suspect is my nginx server configuration.
    but now i found not all mapped domain got that issue.
    i already try to follow many suggestion from many article i read with no luck

    regards,

  • Vinod Dalvi
    • WP Unicorn

    Hi @mprasodjo,

    If possible could you please share your real site URLs so that we can test it.

    Would you mind if I logged in to your site and did some troubleshooting? This might help get to the bottom of this faster. If this is ok, just grant me temporary admin access to your site by clicking "Grant Access" button in the WPMU DEV Dashboard Settings as described on the following page and reply on this thread after granting it?

    https://premium.wpmudev.org/manuals/wpmu-dev-dashboard-enabling-staff-login/

    Regards,
    Vinod Dalvi

  • Jude
    • DEV MAN

    Hi @mprasodjo

    Sorry the response took a while longer than expected. Appreciate your patience. Looks like Vinod is really busy and this one slipped through the gaps, I'm gonna take the liberty of chipping in here.

    This looks like a double redirect (mis)configured. Can you remove all instances of "https" from your site settings ? Like in site url etc .. and let nginx handle it completely.

    Cheers
    Jude

  • mprasodjo
    • Design Lord, Child of Thor

    yes sure, i already try to remove all instances of https, remove plugin, change a server, change a webserver to apache, create fresh new installation and so on.

    i create this post at feb 17 and until today this problem is still there and also make another post before this post. and still there is no clue i found to solve this. and i'm start to scare to use plugin with no support for more serious site i have.

  • Jose
    • Bruno Diaz

    Hi there @mprasodjo,

    Hope you are doing great today. I appreciate your patience with this issue.

    I was working on a similar problem in other thread and found a glitch with the redirections over HTTPS.

    I'll ask you to please test the attached beta and let me know if that solves the issue for you.

    If that doesn't make any difference, I will need to take a look directly on your install.
    In order to do that, I'll ask you to please send me the following information via contact form :

    - In the subject field add "Attn: Jose”
    - Link back to this thread
    - Include WP admin/network access
    - Include FTP host and credentials.
    - Include any relevant URLS for your site

    On the contact form, select "I have a different question", this ensures it comes through and gets assigned to me.

    Thanks in advance,
    Jose

  • Jose
    • Bruno Diaz

    Hi again Matias,

    I finally found the cause of the issue.

    There is a problem on how the SERVER_NAME is being handled in your nginx configuration.
    Normally, SERVER_NAME and HTTP_HOST should be the same and both should reflect the actual domain serving the request.
    In your case, the value of $_SERVER['SERVER_NAME'] is always returning "tangtunganproject.com".
    This would happen likely because you have this setup in some of your .conf files.

    In order to make it work as expected I changed on line of the plugin core. You may want to look into your nginnx config to solve the issue, or simply change this line after each update of the plugin.

    In the file ../wp-content/plugins/domain-mapping/classes/Domainmap/Module.php line 250, change this:
    $current_domain = isset( $_SERVER['SERVER_NAME'] ) ? $_SERVER['SERVER_NAME'] : $_SERVER['HTTP_HOST'];
    into this:
    $current_domain = isset( $_SERVER['HTTP_HOST'] ) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'];
    That way, we change the priority and the plugin will prioritize HTTP_HOST value when resolving redirects.

    Please give it a go to the site and let me know if you find any other issue.

    Cheers!
    Jose

  • mprasodjo
    • Design Lord, Child of Thor

    Let me update my investigation, even it not finish yet.

    my nginx config is always same since long time, except i turn off ssl 3.
    my nginx server was updated several times
    my wordpress updated following update notification
    my multi-domain is also updated following update notification

    nginx : in a version before from ppa.launchpad.net/nginx, everyting is running without a problem it happen in last version i use. the key of this problem is in a list of server_name directive i use to define several domain name.

    last year, which i don't know exactly which version from that 3 combination, it is ok if i use server_name directive list randomly, but in today version, i need to put a main domain at the first list of server_name directive.
    and if not doing that, we have to clear browser cookie everytime we want to accessing a domain.
    if we not doing that, a server will give you loop cookie and make loop connection between http and https.

    Thank you for wpmu great effort to help me find this problem.
    Hope it can help other one who use nginx like me.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.