css and js files are https when they should be http

Hi I noticed that the membership css files did not load as they should and some other issues (probably related to membership .js file).
I am also using domain mapping plugin and other plugins etc generates the correct url starting with procampxl.se instead of multisite name procampxl.startaenweb.com. Would be nice if membership would too (not a biggie, the site will work with full multisite url)

here is a couple of lines generated from page http://procampxl.se (as you can see membership css is prefixed with https and my site does not have port 443 open and no SSL certificate etc. Bit of a problem...

<link rel="alternate" type="application/rss+xml" title="ProcampXL » flöde" target="_blank" href="http://procampxl.se/feed?k%5B0%5D=5a5e2f6d1d5ba7f798a984fcd9ae0ba5" />
<link rel="alternate" type="application/rss+xml" title="ProcampXL » kommentarsflöde" target="_blank" href="http://procampxl.se/comments/feed?k%5B0%5D=5a5e2f6d1d5ba7f798a984fcd9ae0ba5" />
<link rel='stylesheet' id='admin-bar-css' target='_blank' href='http://procampxl.se/wp-includes/css/admin-bar.min.css?ver=3.5' type='text/css' media='all' />
<link rel='stylesheet' id='accountformcss-css' target='_blank' href='https://procampxl.startaenweb.com/wp-content/plugins/membership/membershipincludes/css/accountform.css?ver=3.5' type='text/css' media='all' />
<link rel='stylesheet' id='publicformscss-css' target='_blank' href='https://procampxl.startaenweb.com/wp-content/plugins/membership/membershipincludes/css/publicforms.css?ver=3.5' type='text/css' media='all' />
<link rel='stylesheet' id='contact-form-7-css' target='_blank' href='http://procampxl.se/wp-content/plugins/contact-form-7/includes/css/styles.css?ver=3.3.2' type='text/css' media='all' />
<link rel='stylesheet' id='suffusion-theme-css' target='_blank' href='http://procampxl.se/wp-content/themes/suffusion/style.css?ver=4.4.4' type='text/css' media='all' />
<link rel='stylesheet' id='suffusion-theme-skin-1-css' target='_blank' href='http://procampxl.se/wp-content/themes/suffusion/skins/light-theme-pale-blue/skin.css?ver=4.4.4' type='text/css' media='all' />

  • Bruno
    • Flash Drive

    If I move some of the css markup to my custom css file things look better, so it is really a problem with https url not being able to load from non-existing SSL server.
    Possibly something wrong in functions.php (base setting) maybe?:

    function set_membership_url($base) {

    global $M_membership_url;

    if(defined('WPMU_PLUGIN_URL') && defined('WPMU_PLUGIN_DIR') && file_exists(WPMU_PLUGIN_DIR . '/' . basename($base))) {
    $M_membership_url = trailingslashit(WPMU_PLUGIN_URL);
    } elseif(defined('WP_PLUGIN_URL') && defined('WP_PLUGIN_DIR') && file_exists(WP_PLUGIN_DIR . '/membership/' . basename($base))) {
    $M_membership_url = trailingslashit(WP_PLUGIN_URL . '/membership');
    } else {
    $M_membership_url = trailingslashit(WP_PLUGIN_URL . '/membership');
    }
    if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) {
    $M_membership_url = preg_replace('/http:disappointed:i', 'https:', $M_membership_url);
    }
    }

  • Fullworks
    • The Bug Hunter

    There is something strange with your server set up ....

    the https is added in the function in these lines of code, which look fine, it is looking at $_SERVER which is the external server variables, nothing to do with Wordpress, so looks like some form configuration issue with your webserver

    if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) {
    		$M_membership_url = preg_replace('/http:/i', 'https:', $M_membership_url);
    	}

    Why don't you stick

    <?php print_r($_SERVER); ?>

    at the top of your header.php and see what values you get?

  • Bruno
    • Flash Drive

    Looks OK to me. Can't understand why the code thinks it is HTTPS. Here is the output:
    Array ( [SERVER_SOFTWARE] => Apache [REQUEST_URI] => / [HTTP_HOST] => procampxl.se [HTTP_USER_AGENT] => Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20100101 Firefox/17.0 [HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 [HTTP_ACCEPT_LANGUAGE] => en-US,en;q=0.5 [HTTP_ACCEPT_ENCODING] => gzip, deflate [HTTP_CONNECTION] => keep-alive [HTTP_REFERER] => http://procampxl.se/ [HTTP_COOKIE] => __utma=1.1534117889.1355755867.1355770831.1355773998.6; __utmc=1; __utmz=1.1355755867.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utma=88949722.869829473.1355755867.1355770831.1355773998.6; __utmc=88949722; __utmz=88949722.1355755867.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); wordpress_test_cookie=WP+Cookie+check; spo_5_fa=0f4787fede7ec1bf619fa7c443ab8239; __utmb=1.1.10.1355773998; __utmb=88949722.1.10.1355773998 [HTTP_CACHE_CONTROL] => max-age=0 [PATH] => /usr/local/bin:disappointed:usr/bin:disappointed:bin [SERVER_SIGNATURE] =>
    Apache Server at procampxl.se Port 80
    [SERVER_NAME] => procampxl.se [SERVER_ADDR] => 10.0.0.132 [SERVER_PORT] => 80 [REMOTE_ADDR] => 90.226.164.49 [DOCUMENT_ROOT] => /var/www/wp0101 [SERVER_ADMIN] => webmaster@localhost [SCRIPT_FILENAME] => /var/www/wp0101/index.php [REMOTE_PORT] => 53283 [GATEWAY_INTERFACE] => CGI/1.1 [SERVER_PROTOCOL] => HTTP/1.1 [REQUEST_METHOD] => GET [QUERY_STRING] => [SCRIPT_NAME] => /index.php [PHP_SELF] => /index.php [REQUEST_TIME] => 1355774020 [HTTPS] => Off )

  • Fullworks
    • The Bug Hunter

    Think I have spotted it

    code says
    $_SERVER['HTTPS'] !== 'off'

    your output says

    [HTTPS] => Off

    try changing the function to to do the check on lowercase

    if (!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off' || $_SERVER['SERVER_PORT'] == 443) {

    If that fixes, then hopefully a developer will fix the plugin :slight_smile:

  • Bruno
    • Flash Drive

    No I havent even activated SSL or port 443 on server and no SSL entires in config file. I only have domain mapping and multisite turned on in config. I also use supercache but have taken care to clear that cache as well as client cache when testing. I can for the life of me not figure out why it should translate to https and multisite domain name procampxl.startaenweb.com.
    The same output on the /register/ page (no mention of https, and correct domain name procampxl.se):

    Array ( [SERVER_SOFTWARE] => Apache [REQUEST_URI] => /register/ [REDIRECT_STATUS] => 200 [HTTP_HOST] => procampxl.se [HTTP_USER_AGENT] => Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20100101 Firefox/17.0 [HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 [HTTP_ACCEPT_LANGUAGE] => en-US,en;q=0.5 [HTTP_ACCEPT_ENCODING] => gzip, deflate [HTTP_CONNECTION] => keep-alive [HTTP_REFERER] => http://procampxl.se/ [HTTP_COOKIE] => __utma=1.1534117889.1355755867.1355770831.1355773998.6; __utmc=1; __utmz=1.1355755867.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utma=88949722.869829473.1355755867.1355770831.1355773998.6; __utmc=88949722; __utmz=88949722.1355755867.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); wordpress_test_cookie=WP+Cookie+check; spo_5_fa=0f4787fede7ec1bf619fa7c443ab8239; __utmb=1.6.10.1355773998; __utmb=88949722.6.10.1355773998 [HTTP_CACHE_CONTROL] => max-age=0 [PATH] => /usr/local/bin:disappointed:usr/bin:disappointed:bin [SERVER_SIGNATURE] =>
    Apache Server at procampxl.se Port 80
    [SERVER_NAME] => procampxl.se [SERVER_ADDR] => 10.0.0.132 [SERVER_PORT] => 80 [REMOTE_ADDR] => 90.226.164.49 [DOCUMENT_ROOT] => /var/www/wp0101 [SERVER_ADMIN] => webmaster@localhost [SCRIPT_FILENAME] => /var/www/wp0101/index.php [REMOTE_PORT] => 57086 [REDIRECT_URL] => /register/ [GATEWAY_INTERFACE] => CGI/1.1 [SERVER_PROTOCOL] => HTTP/1.1 [REQUEST_METHOD] => GET [QUERY_STRING] => [SCRIPT_NAME] => /index.php [PHP_SELF] => /index.php [REQUEST_TIME] => 1355777364 [HTTPS] => Off )

  • Bruno
    • Flash Drive

    YES! It fixed the forced https in the output!
    So now it works, and gives me normal http URIs!

    It still uses my multisite address procampxl.startaenweb.com instead of the procampxl.se domain in the URL, but both work so no great damage there. We could call it a cosmetic bug. Just remind the developer that he/she should look into that issue since it could have implications for sites using CDN delivery mechanisms.

    I am happy that the includes work for both the .css and the .js files now!
    Thanks a lot!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.