WordPress.org

Ready to get started?Download WordPress

Forums

WPtouch Mobile Plugin
Plugin switches to https when changing between mobile and standard view (27 posts)

  1. gavinwatson
    Member
    Posted 1 year ago #

    Hello!

    I have noticed that on two of the websites I have installed this plugin on when switching betweenmmobile and standard view the plugin switches to https:// instead of http:// and therefore thrown up an error.

    How do I stop it trying to go https:// ?

    Thanks in advance!

    http://wordpress.org/extend/plugins/wptouch/

  2. Ron Whitler
    Member
    Posted 1 year ago #

    I'm having the same problem.

    The URL in question is http://leveraging.us

    The mobile site loads correctly, but when I flip the switch to go to turn off the mobile theme, the URL loads as "https" and doesn't load.

    If I manually load the non-mobile page and then flip the switch back to mobile, the "s" is added to http and it doesn't load.

    I'm on a self hosted network - WP v 3.4.2 - the other 4 blogs on my network do not have this problem. They switch fine.

    I'm using the plugin WordPress MU Domain Mapping V 0.5.4.2 to map the domain leveraging.us onto my installation.

    These 2 threads seem to reference the same issue:

    http://wordpress.org/support/topic/plugin-wptouch-how-to-turn-off-https?replies=7

    http://wordpress.org/support/topic/plugin-wptouch-error-404-when-changing-to-desktop-site?replies=6

    Thanks for any help you can give.

  3. BraveNewCode Inc.
    Member
    Plugin Author

    Posted 1 year ago #

    Hi gavinwatson,

    Do you have any ssl-based plugins or setups going on on your website at all?

    Same question for you Ron. What's the difference between the site you're seeing this issue on and the rest of the sites in your multisite network?

  4. gavinwatson
    Member
    Posted 1 year ago #

    Hi, thanks for responding.

    No, I have no ssl-based plugins, I do not run multisite either.

    Thanks

  5. BraveNewCode Inc.
    Member
    Plugin Author

    Posted 1 year ago #

    Thanks for the info there gavinwatson. Please share the URL of at least one of the website in question and we'll be happy to take a look for you. Also, what device are you using to test?

  6. gavinwatson
    Member
    Posted 1 year ago #

    http://www.canariesnews.com
    http://www.canariestelecom.com

    I'm using a Samsung Galaxy SIII

    Thanks

  7. Ron Whitler
    Member
    Posted 1 year ago #

    >>What's the difference between the site you're seeing this issue on and the rest of the sites in your multisite network?

    The only difference between the one that's not working and the ones that are seems to be the Domain Mapping plugin

    here are some blogs on my network that work:
    http://celiamusic.net
    http://blog.celiamusic.net
    http://tanner.celiamusic.net
    http://ron.celiamusic.net

    the one that doesn't work is http://leveraging.us -- it's domain mapped to http://leverage.celiamusic.net

    using the plugin: WordPress MU Domain Mapping - Version 0.5.4.2

    WordPress is current - 3.4.2

    I'm having the issue on iphone with current software and droid.

    The message I'm receiving is "unable to establish a secure connection."

    Turning the mobile theme off attempts to establish the connection via https (the same thing happens coming from standard to mobile version)

  8. Jacquesdancona
    Member
    Posted 1 year ago #

    I've noticed we're having the same problem. Desktop mode redirects to https instead of http. We're not using any cache plugins at this moment and we do not use plugins related to ssl.

  9. Jacquesdancona
    Member
    Posted 1 year ago #

    Quick dirty fix is to edit line 554 of wptouch.php to

    $protocol = ( !empty($_SERVER['HTTPS']) ) ? 'http://' : 'http://';

    BraveNewCode Inc.,

    it's late over here in the Netherlands, I'm sleepy and already in bed so forgive me if I make any mistakes.

    Using empty() with $_SERVER['HTTPS'] here isn't going to work for some users because

    $_SERVER['HTTPS']
    Note: Note that when using ISAPI with IIS, the value will be off if the request was not made through the HTTPS protocol.

    Source

    'Off' is what I get when I echo $_SERVER['HTTPS'].

  10. Jacquesdancona
    Member
    Posted 1 year ago #

    This seems to do the trick without forcing $protocol to use http://,
    change line 554 of wptouch.php to:

    $protocol = ( !empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == 'off' ) ? 'https://' : 'http://';

    I'm not sure about this though. Use it your own risk :)

  11. BraveNewCode Inc.
    Member
    Plugin Author

    Posted 1 year ago #

    Because this is not a widely reported issue, we are speculating that there is something else in common with the sites in question where this occurs. Perhaps you happen to be using the same desktop theme or themes from the same developer? Until we can reproduce the issue here, we really haven't a way to test what's happening for you so as much information about your individual WordPress configurations (themes and plugins) from all affected is helpful.

    @Jacquesdancona, thank you for sharing your solution. Hopefully it is helpful to others experiencing this issue until it's isolated and address on our end.

  12. Jacquesdancona
    Member
    Posted 1 year ago #

    I'm wrong about my fix and I need to be sleeping. Last thing I found with help from here:

    if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off'
        || $_SERVER['SERVER_PORT'] == 443) {
    
        $protocol = "https://";
    } else {
       $protocol = "http://";
    }
  13. gavinwatson
    Member
    Posted 1 year ago #

    On from what Jacquesdancona has written, I also decided to take a look at this and I found in this code from wptouch.php (inside the wptouch folder within the plugins folder):

    function bnc_check_switch_redirect() {
    		if ( isset( $_GET['wptouch_redirect'] ) ) {
    			if ( isset( $_GET['wptouch_redirect_nonce'] ) ) {
    				$nonce = $_GET['wptouch_redirect_nonce'];
    				if ( !wp_verify_nonce( $nonce, 'wptouch_redirect' ) ) {
    					_e( 'Nonce failure', 'wptouch' );
    					die;
    				}
    
    				$protocol = ( !empty($_SERVER['HTTPS']) ) ? 'https://' : 'http://';
    				$redirect_location = $protocol . $_SERVER['SERVER_NAME'] . $_GET['wptouch_redirect'];
    
    				header( 'Location: ' . $redirect_location );
    				die;
    			}
    		}
    	}

    If you change this line FROM:

    $protocol = ( !empty($_SERVER['HTTPS']) ) ? 'https://' : 'http://';

    TO this :

    $protocol = ( !empty($_SERVER['HTTPS']) ) ? 'http://' : 'http://';

    (removed the 's' from https)

    It all seems to work fine.

    Unfortunately, I don't know what other effects this may have! But it worked for me.

  14. gavinwatson
    Member
    Posted 1 year ago #

    Hi, sorry, I have just realised that my solution is exactly the same as the one already provided!

    I'm not sure why the original solution (which is the same as what I did) is not sufficient? Will it have any other effect that I should be worried about??

    Thanks

  15. Jacquesdancona
    Member
    Posted 1 year ago #

    Hi Gavin,

    That's what I tried to explain in my quick dirty fix post (4 posts back ;) ).

    This will work for you because you're forcing it to use 'http://'.
    If you don't use https in any way this won't result (I think) in any problems. However, if you update WPtouch the edit will be overwritten with a new wptouch.php.

    The problem does not seem to be theme or plugin related because I did a fresh install yesterday (default Twenty Twelve theme) with only WPTouch installed and the problem still occurs. I've already tested this three WordPress installs on two Microsoft-IIS/6.0 systems (one VPS and one shared hosting account).

    I'm currently emailing with Brave New Code and they have access to these WP installs. They'll probably check today.

    By the way, thanks for the quick support and emails, Brave New Code!

  16. BraveNewCode Inc.
    Member
    Plugin Author

    Posted 1 year ago #

    We've had a look at @Jacquesdancona's setup and can reproduce the error though, still, not in any of our development environment setups. That leads us to suspect his server setup. There may be server-side commonalities among those experiencing the issue. We recommend reporting the issue to your host to see what they can track down for you.

  17. Jacquesdancona
    Member
    Posted 1 year ago #

    Hey Gavin and Ron,

    could you guys check if you're hosted at Microsoft IIS servers? You can ask your hoster or check what the value of $_SERVER['SERVER_SOFTWARE'] is. To do that create a new php file and add the following to it:

    <?php
    echo $_SERVER['SERVER_SOFTWARE'];
    ?>

    Save it and upload the file to your website. Visit it at your website and check whats showing. Could you post the result here? It might be something like 'Microsoft-IIS/*version*'. Please delete the file afterwards.

    Brave New Code, I've sent you a new email with some more explanation :)

  18. Ron Whitler
    Member
    Posted 1 year ago #

    I made the plugin edit outlined above and that seems to have taken care of it.

    Jacques, thanks for jumping in. I ran the server check you mentioned above. Feel free to email me at ronwhitler(at)gmail(dot)com and I'll update you on my results.

    I'm happy to help do whatever testing that helps.

    Thanks for the help. ~ Ron

  19. gavinwatson
    Member
    Posted 1 year ago #

    I'm on Microsoft-IIS/7.0

  20. Ron Whitler
    Member
    Posted 1 year ago #


  21. Jacquesdancona
    Member
    Posted 1 year ago #

    Ron, the only testing you could do for me is to check what server software your hoster uses :)

    Thanks Gavin. My hoster is using Microsoft-IIS/6.0 so we pretty much can be sure about what is causing the problem we're having.

    I've received another email from Brave New Code.

    We have noted this issue for investigation for development with a future release of WPtouch and WPtouch Pro.
    so I guess it'll be fixed in the next WPtouch update :D

  22. gavinwatson
    Member
    Posted 1 year ago #

    Always good to see developers recognise and take note of issues. As we use many plugins that are made freely available to us, the least we can do is help make the product better!

    Pleased to have been of assistance :-)

  23. BraveNewCode Inc.
    Member
    Plugin Author

    Posted 1 year ago #

    We try.
    ;)

  24. Ron Whitler
    Member
    Posted 1 year ago #

    I'm just posting an update - I updated to 1.9.6.1. The update recreated the problem and I and needed to edit the plugin with the workaround described by Jacquesdancona above and the workaround is making it happen again.

  25. Sperry77
    Member
    Posted 1 year ago #

    This post was great. I was having the same exact problem and once I changed to this:
    $protocol = ( !empty($_SERVER['HTTPS']) ) ? 'http://' : 'http://';
    the problem went away.

    BraveNewCode has updated their version since this thread and it still hasn't been fixed, so I had to use the hack. Hope it doesn't cause a security issue.

  26. Jacquesdancona
    Member
    Posted 1 year ago #

    Hi Sperry,

    Can you check if your website is hosted on Windows servers? I still think that's the problem here.

    We're not using WP Touch anymore but I'm still curious.

  27. Sperry77
    Member
    Posted 1 year ago #

    I'm pretty sure it is a windows based server.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic