Domain mapping go to main site after upgrade to 4.4.0.2

Hi

My main site is tangtungan.com
Have a sub domain,
gauli.tantungan.com mapped to gauli.com
garispaksi.tangtungan.com mapped to garispaksi.com

After upgrading to domain mapping version 4.4.0.2 i found such behavior (using different browser)
1. if i'm using different browser (clear cache and cookie) and go to gauli.com, it go to loop ("This webpage has a direct loop" message from browser).
2. if i go to to garispaksi.com (clear cache and cookie), it go to tangtungan.com (main page)
3. if i'm using same browser that already login to main site, if i go to gauli.com, i get "This webpage has a redirect loop" message and same as garispaksi.com. but if i go to gauli.com/wp-login.php or gauli.com/wp-admin/ site is open as expected for it url.

I try to rollback to previous version and now i got same behavior.

Anyone can help me to analyze this ?

server nginx
domain mapping 4.4.0.2
wp 4.2.1

  • Adam Czajczyk

    Hey @mprasodjo,

    I hope you're well today and thank you for your question!

    I've followed the issue step-by-step as you described it but everytime I'm being redirected directly to Tangtungan domain (or its wp-login.php page accordingly). That being said, have you changed anything since your post here? If so, what was it? Please advise!

    Also, it would be great if you could grant me a support access so I could take a closer look at the site's settings. To do so, go to your dashboard's

    "WPMU DEV" -> "Support" page -> "Support" tab

    and click "Grant access" button.

    Please be sure to take a full backup of your entire site first!

    Cheers,
    Adam

  • Adam Czajczyk

    Hey @mprasodjo,

    I hope you're well today!

    I browsed the sites in question once again on different computer and with totally new browser install and again, I didn't have any "redirect loop" reports. Instead I was redirected straight to your main domain.

    I've logged to your dashboard and checked the settings and everything seems to be fine there. Then I've checked those two domains with tracert tool just to make sure they point to the right IP. Since they are, I headed up to Pingdom's "Full Page Test" at

    .tools.pingdom.com

    and checked both domains with their tools. Take a look at the screenshot please - it seems that there's a redirect for the domain (it's the same with another one) that redirects user's browser right to your main domain before the request even reach your site, thus Domain Mapping doesn't even try to handle the request.

    If you have an access to the nginx configuration, please check if there's any redirect defined (or ask your hosting provider to check it for you)!

    Let me know of the results, please!

    Cheers,
    Adam

  • mprasodjo

    Hi Adam

    I check already a nginx configuration
    There is no redirect option in there.

    Redirected to main site only happen if you not logged in.
    If you logged in, you will got redirect loop.

    Like i mention, after login, i can go to /wp-admin for both domain.

    And then i do try to change

    /wp-content/plugins/domain-mapping/classes/Domainmap/Module.php line 251

    from

    $current_domain = isset( $_SERVER['SERVER_NAME'] ) ? $_SERVER['SERVER_NAME'] : $_SERVER['HTTP_HOST'];

    into

    $current_domain = isset( $_SERVER['HTTP_HOST'] ) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'];

    After that, gauli.com can open, but not garispaksi.com

    I change back a code to original and now

    I can not go to gauli.com/wp-admin but can open gauli.tangtungan.com/wp-admin/
    But for garispaksi.com/wp-admin/ i got a blank page.

    I suspecting something in name handler. But it quite strange since everthing is running fine until i do update. Latest update give a same result. Try to rollback still give a same result.
    I don't have any clue where is a problem.

  • Adam Czajczyk

    Hey @mprasodjo,

    I've accessed your site's dasbhoards, checked the settings again and then created myself a test account account. However, logged in or not, I was being redirected to the main site each time without any loops. I've got a feeling that I'm missing something in my attempts to replicate the issue.

    Having said that, could you please give me exact step by step description of what should I do to get the very same effect? Please assume that I've never visited you site, have no account and no site.

    Also, I've noticed that you're probably working on your site at the moment (there was a "site under maintenance" message) so I'm backing off until you're done.

    Notify me please when I can access your site again!

    Regards,
    Adam

  • Adam Czajczyk

    Hey @mprasodjo,

    I hope you're well today and thank you for your feedback!

    I've visited your site again and checked its settings once more. As everything still looks fine, I've tried to replicate the issue one more time but no luck: I'm getting redirected to the main site. Please see the video:

    http://screencast.com/t/CxJGpfcdx

    Perhaps this will let you spot what am I doing wrong? If you however think that everything shown on the video works as as expected, then please once again clear all the caches (your browser's as well as on the site) and check it again. I'm starting to think that this might be a local issue, unless I'm missing something here! Please advise.

    Cheers,
    Adam

  • Adam Czajczyk

    Hey @mprasodjo,

    I hope you're doing fine!

    I assume that you've seen the screencast I posted and you can confirm that I'm doing everything right, am I correct? Please advise!

    If so, could we please go back to basics for a moment? If you could check for the issue using another browser on another machine and preferably on another network, it would be great. If it does work, then - at your original location - give it one more try but with all the firewalls and antivirus software disabled for the moment. Let me know of the results!

    Cheers,
    Adam

  • mprasodjo

    Hi Adam,

    Yes i see that sreencast.

    I check it with my other machine and other browser, both windows and linux machine.
    Sometimes i got loop, sometimes it go to main site.
    So that's why i said it getting more weird and weird.

    Since i need a sub domain getting up and working as soon as possible, i have to move it to my other multisite at different site. Problem is, i can not open open a site, so using an import and export tools is useless. Since it can not download an image and other.

    Is there any tools that we can dump a database specific for some subdomain for this case ?

    Regards,

    M. Prasodjo

  • Adam Czajczyk

    Hey @mprasodjo,

    I hope you're well today!

    Sometimes i got loop, sometimes it go to main site.
    So that's why i said it getting more weird and weird.

    That's indeed weird and it leads me to thinking that it actually may be a server related issue. However, we'll be sure after the site is moved.

    For dumping a database I think the easiest way in this case would be to simply use a phpMyAdmin's (or other db manager's) internal export tool. You need to identify the table prefix for this particular site (which will probably be wp_X_ where X is a number) and then use "Export" option, selecting the tables prefixed with this string.

    The issue is however, there may be a conflict of prefixes as there might already exist some tables with the same prefix on your other Multisite install.

    Having said that I can see two ways of dealing with this (let's assume that your "old" network is called "A" and a new one is called "B"):

    1.
    Create a new site on B (make sure there are the same plugins and the configuration is the same or at least very close to A), export db tables from A, manually modify the tables to match B URL and import db to B

    2. Create a new site on B (the same rules apply), use WP export tool to export data from A and then use import tool on B to import data

    Both these solutions however might require some trials and manual changes to the db.

    If you need any further assistance on this, please ask. I'll be glad to help!

    Regards,
    Adam

  • mprasodjo

    Hi Adam,

    I do research about this problem and i found something.
    If i change a web server to apache look like a problem gone, accept some plugin and themes like upfront, failed to find a some directory. And also i found a cookie problem if i want to accessing admin area of other domain.

    I suspecting there is some problem with configuration of nginx that i use and domain mapping. Since this problem happen after upgrading, may be there is some conflict in rules between nginx and domain mapping or other plugin/themes. But need more research to make sure.

    Regards

    M. Prasodjo

  • mprasodjo

    Would you check below rules ?

    set $skip_cache 0;

    port_in_redirect off;
    autoindex off;

    client_max_body_size 2m;
    client_body_buffer_size 128k;

    # Avatar plugin
    rewrite ^/(.*/)?avatar/(.*) /wp-content/avatar.php?file=$2 last;

    # POST requests and urls with a query string should always go to PHP
    if ($request_method = POST) {
    set $skip_cache 1;
    }
    if ($query_string != "") {
    set $skip_cache 1;
    }

    # Don't cache uris containing the following segments
    if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|/wp-(app|cron|login|register|mail).php|wp-.*.php|/feed/|index.php|wp-comments-popup.php|wp-links-opml.php|wp-locations.php|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") {
    set $skip_cache 1;
    }

    # Don't use the cache for logged in users or recent commenters
    if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in") {

    set $skip_cache 1;
    }

    try_files $uri $uri/ /index.php?$args;

    # Deny access to hidden files
    location ~* /\.ht {
    deny all;
    access_log off;
    log_not_found off;
    }

    #The section below contains your WordPress rewrite rules
    location / {
    try_files $uri $uri/ /index.php?$args;
    }

    #location /search { limit_req zone=one burst=3 nodelay; rewrite ^ /index.php; }

    fastcgi_intercept_errors off;
    location ~* \.(ico|css|js|gif|jpe?g|png)$ {
    expires max;
    add_header Pragma public;
    add_header Cache-Control "public, must-revalidate, proxy-revalidate";
    }

    #Send the php files to upstream to PHP-FPM
    #This can also be added to separate file and added with an include
    location ~ \.php$ {
    try_files $uri =404; #This line closes a big security hole
    #see: http://forum.nginx.org/read.php?2,88845,page=3

    fastcgi_param SCRIPT_NAME $fastcgi_script_name;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

    include fastcgi_params;
    fastcgi_connect_timeout 60;
    fastcgi_send_timeout 180;
    fastcgi_read_timeout 180;
    fastcgi_buffer_size 128k;
    fastcgi_buffers 256 4k;
    fastcgi_busy_buffers_size 256k;
    fastcgi_temp_file_write_size 256k;

    fastcgi_pass 127.0.0.1:9000;

    proxy_read_timeout 300;

    fastcgi_cache_bypass $skip_cache;
    fastcgi_no_cache $skip_cache;

    fastcgi_cache WORDPRESS;
    fastcgi_cache_valid 60m;
    }

    location ~* /(?:uploads|files)/.*\.php$ {
    deny all;
    }

    #WPMU Files
    location ~ ^/files/(.*)$ {
    try_files /wp-content/blogs.dir/$blogid/$uri /wp-includes/ms-files.php?file=$1 ;
    access_log off; log_not_found off; expires max;
    }

    #WPMU x-sendfile to avoid php readfile()
    location ^~ /blogs.dir {
    internal;
    alias /var/www/example.com/htdocs/wp-content/blogs.dir;
    access_log off; log_not_found off; expires max;
    }

  • mprasodjo

    Hi

    I want to update this case.
    I try to move to apache. after a while a problem come again.

    So now i try to move every site to different multisite. and bellow is a result.

    1. login to main site --> garispaksi.com --> redirect loop
    2. login to main site --> http://www.garispaksi.com --> normal
    3. fresh browser --> garispaksi.com --> offering to register
    4. fresh browser --> http://www.garispaksi.com --> normal
    5. login or not --> subdomain --> normal

    in a old multisite, if i try to use www, a www will be gone and it going to domain without www.
    in this new multisite, this case is only happen specific for this domain only.
    i double check a dns record and it already mapped correctly.
    Status in domain mapping plugin also said it health.
    I'm start thinking that this domain without www is not recoqnize by wp.

    log file in a web server is looping and show this sample line
    xxx.xxx.xxx.xxx - - [25/May/2015:00:16:35 +0700] "GET / HTTP/1.1" 302 5 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.65 Safari/537.36"

    now i put it back to old site and will be check again

    Regards

    M. Prasodjo

  • Adam Czajczyk

    Hey @mprasodjo

    I hope you're well today!

    This gives me an insane idea :slight_smile: Could you please check if your garispaksi.com site's settings in:

    - .htaccess and wp-config (for Multisite)
    - site's "Settings" -> "General"
    - Domain Mapping settings
    - all the possible database values (you may need to perform a search on your db to find this out)

    all match exactly the same domain? May it be "garispaksi.com" or "www.garispaksi.com" but it has to keep the same form everywhere (so it shouldn't occur as "garispaksi.com" in one place and as "www.garispaksi.com" in another).

    Would you check it for me please?

    Regards,
    Adam

  • mprasodjo

    Hi Adam,

    1. like we already discuss before, i'm using nginx. and nginx do not use .htaccess
    2. site's "Settings" -> "General" --> what should i see in here ?
    3. in attachment
    4. db value searching, i'm searching using a query to search every table and field.
    in new multisite
    - nothing found for %www.garispaksi%
    - i'm found many for %garispaksi% but not found anything unusual
    in old multisite
    - found for %www.garispaksi% but in comment or post, i'm sure it not connected to this problem.
    - i'm found many for %garispaksi% but not found anything unusual

    btw, before this problem, either i use www or not, it will go to a same site without any problem.

    and today i want to try something stupid that may be can give me more clue.

    Regards

    M. Prasodjo

  • Predrag Dubajic

    Hi @mprasodjo,

    Thanks for confirming!

    Could you provide us with FTP and cPanel access so we can investigate this further?

    You can send us your details using our contact form and the template below:

    IMPORTANT: Make sure you select "I have a different question" for your topic so it doesn't go back to forums - this and the subject line ensure that it gets assigned to me.

    Subject: "Attn: Predrag Dubajic"
    - WordPress admin username
    - WordPress admin password
    - login url
    - FTP credentials (host/username/password)
    - cPanel credentials (host/username/password)
    - link back to this thread for reference
    - any other relevant urls

    Best regards,
    Predrag

  • Adam Czajczyk

    Hey @mprasodjo,

    I hope you're well today!

    I'm not sure if you've noticed this but after checking your domain's DNS's (with the tools you mentioned) I get this warning:

    Oops! Your name servers don't all seem to have identical NS records for your domain. This could lead to some visitors not being able to see your site (or seeing it on a different server)! This should be fixed ASAP!

    I think that's worth your attention and also I've passed this information to the developer.

    Cheers,
    Adam

  • Adam Czajczyk

    Hey @mprasodjo

    I tested garispaksi.com as this is the domain in question, if I'm not missing something here.

    If a domain is not exist we will fail to connect to server and will not got redirect loop.

    Sure thing. The domain exists though, I just tested it against DNS correctness. I can see now that you've made some changes on this domain as the site seems to be a clean site with Twenty Fifteen theme activated. Are there any other changes perhaps? Please advise.

    Cheers,
    Adam

  • Adam Czajczyk

    Hey M.Prasodjo,

    I hope you're doing fine.

    I wonder if you could update your Domain Mapping plugin to a newest release, could you ?

    Apart from some previous fixes since 4.4.02 version, last update which was released just a few days ago features fixes for "Issue in login functionality when both admin and login mappings are original" and "Bugs in unswap url and login and sso from https pages".

    This sounds partially relevant to the case, so there's a chance it can help.

    Let me know please if it did!

    Regards,
    Adam

  • mprasodjo

    Hi Adam

    Domain mapping now using 4.4.0.6
    But i found something

    accessing domain garispaksi.com :
    - if i use my pc browser (clean cache and cookie), i got redirect loop
    - But i use my android browser (clean or not), i got a page, with correct header, but a themes it use is default wordpress (twenty fifteen) and only 1 hello world posting. Other posting is gone.

    accessing garispaksi.silat.info
    - if open a domain using any browser it open correctly, with correct themes

    Regards,

    M. Prasodjo

  • Adam Czajczyk

    Hey mprasodjo!

    Now, this is something interesting!

    - But i use my android browser (clean or not), i got a page, with correct header, but a themes it use is default wordpress (twenty fifteen) and only 1 hello world posting. Other posting is gone.

    Although accessing the site with PC browser, I was served exactly the same site: Twenty Fifteen theme and one "Hello world" post. That's why I've asked you recently if you've made any changes to the site!

    To make things even more complicated, now on a PC browser I'm getting the same site under garispaksi.silat.info and garispaksi.com. Furthermore, I'm getting the same on my Win-powered mobile and Android tabled, either through a cable net and through mobile.

    That being said, I'm sure packets from my devices travel completely different way to your sever which leads me to a point that we're probably back to the DNS issues, unfortunately. I might be wrong as well, though. I feel then I'll need a helping hand here, so I've notified our 2nd-level support team and hopefully they'll have a look asap and come up with a solution.

    Regards,
    Adam

  • mprasodjo

    Hi Adam,

    I change something last night, i put back garispaksi.com to garispaksi.silat.info.
    I try to open it using android again and it open correctly. But again if i use a browser (clean cache and cookie or not) i still got redirect loop.

    Something i also found that if i open it with http://www.garispaksi.com, it open correctly. But i map it to garispaksi.com.

    And than i do try to delete domain mapping and put it back again. Now this domain is not recognize by domain mapping. Health status said valid, but if i try to open using any browser it will give me a main site and said to register. I try to delete and put again several time and finally it recognize.

    Both android and pc using a same network connection and dns. I also try to use genymotion to simulate. And than i try to use different browser like iceweasel, konqueror and chromium. Now i found it open correctly.

    I go back to google chrome and firefox 38.0 and found redirect loop. I wonder if gecko framework hate something in domain mapping.

    I'm sure DNS not an issue, since there is nothing change in DNS record but ip address when i try to solve this problem by move it to other multisite and it was working correctly for 2 year. But what i test last night may be a clue that a problem only exist if i use google chrome or firefox 38.

    I will make some other test this night.

    Regards

    M. Prasodjo

  • mprasodjo

    Hi Adam

    Sorry, other duty call.

    Below my founding
    - New release is still have a same problem

    But I also found that this problem only exist if i use Firefox and Google Chrome at Ubuntu 14.04 latest patch that i use, including if i use manual installation of firefox.

    - Firefox and Google Chrome that i try at Windows 7 and 8.1 is working great
    - Firefox and Google Chrome at android also working great
    - Firefox and Google Chrome at Debian and Kali Linux is working great

    Clean cache and cookie at both browser still got redirect loop.

    So i try to remove all of my configuration directory of my firefox and run again my default ubuntu firefox than i found a site open and work like expected. Than i do sync my firefox and waiting. Try again and still i found it working good.

    I try to do same with my google chrome. I remove directory that containing configuration and other thing. And call again my google chrome. Before i do sync, i check a site and it working at expected. But after sync, a redirect loop is back. And than I delete some cookie and site working good again. But when i reload a page, i got a redirect loop again and again even i delete a cookie.

    So i do reset my configuration of my google chrome. And now i found it work.

    I don't know where and how can firefox and google chrome can have this same issue at a same time in my ubuntu.

    Really sorry for a trouble that i make.
    But look like this problem happen because something wrong in a browser.

    I will do some other test to make sure and i will let you know

    Google Chrome Version 43.0.2357.81 (64-bit)
    Firefox 38.0

    Best Regards,

    M. Prasodjo

  • mprasodjo

    Hi Adam

    I forget to mention that both normal or incognito mode is having a same issue and condition like i explain before.

    And after i do some research, a problem will be back if i'm going to old site garispaksi.tangtungan.com. Old site only give me a white page.

    Look like a key of this problem is in an old site. After going to old site, clean a cookie and cache doesn't help. But again, it only effected to google chrome and firefox. Test with chromium is even old site give a white page, garispaksi.com still opened like expected.

    Tested with normal and incognito mode (google chrome, firefox and chromium)

    Regards

    M. Prasodjo

  • mprasodjo

    Hi Adam

    sorry need a long time since my last update. i have another job to be done.

    after doing experiment, i see this like some bug in gecko framework or may be only in google chrome since firefox is working good until now after i delete all config a few day ago.
    before last update, icewesel and other gecko framework browser and some webkit framework browser also have this problem.
    now only google chrome still have this problem.

    interesting. but since i don't have to much time right now to explore i save everything for this time for further check.

    so for this time my hypothesis this problem is because a bug at a browser when meet "something".

    to reproduce it, i just need to login to main site, go to target site (maaping domain front page), go to admin dashboard of target site, go to frontpage site than close a tab, and open new tab and go to target site. and viola, i got redirect loop.
    if i have a freetime i want to try to found what respond that make it happen.

    Thank You and Regards

    M. Prasodjo

  • mprasodjo

    Hi @Predrag Dubajic

    Sorry for very late respons since my work load make me have to go out so many times.

    Yes sure i try to different PC.
    And also after i try several times (also at other pc), i'm sure that this ONLY happen if i do activate google chrome sync account. I'm sure there is something in sync data that make it happen.

    Not sure which one since i don't have much time to debug this right now

    Regards

    M. Prasodjo

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.