• Resolved chexone

    (@chexone)


    Hello,
    I can not update Titles and Descriptions from the Page listing using the ajax functionality. In console I get the error:

    Mixed Content: The page at ‘https://raver.life/wp-admin/edit.php?post_type=page’ was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint ‘http://raver.life/wp-admin/admin-ajax.php’. This content should also be served over HTTPS.

    As you can see in the source, the requestUrl specified in var aioseopadmin is https rather than https. How can I change this to https?

    <script>
    if (document.location.protocol != "https:") {
        document.location = document.URL.replace(/^http:/i, "https:");
    }
    </script>
    <script type='text/javascript' src='https://raver.life/wp-includes/js/tw-sack.min.js?ver=1.6.1'></script>
    		<script type="text/javascript">
    			//<![CDATA[
    			var aioseopadmin = {
    				blogUrl: "https://raver.life",
    				pluginUrl: "http://raver.life/wp-content/plugins/all-in-one-seo-pack/",
    				requestUrl: "http://raver.life/wp-admin/admin-ajax.php",
    				imgUrl: "http://raver.life/wp-content/plugins/all-in-one-seo-pack/images/",
    				Edit: "Edit",
    				Post: "Post",
    				Save: "Save",
    				Cancel: "Cancel",
    				postType: "post",
    				pleaseWait: "Please wait...",
    				slugEmpty: "Slug may not be empty!",
    				Revisions: "Revisions",
    				Time: "Insert time"
    			}
    			//]]>
    		</script>
Viewing 6 replies - 1 through 6 (of 6 total)
  • Michael Torbert

    (@hallsofmontezuma)

    WordPress Virtuoso

    Make sure you have https for your WP address and site address General Settings https://ww.wp.xz.cn/support/article/settings-general-screen/

    Thread Starter chexone

    (@chexone)

    I do already have those set to https.
    It’s a multi-site WP setup, so it doesn’t look like your screencap though.
    Maybe I have missed a place in the database…

    Thread Starter chexone

    (@chexone)

    Nope, all looks good in the database.
    Not sure where it’s getting those ‘http’ values

    Michael Torbert

    (@hallsofmontezuma)

    WordPress Virtuoso

    It’s not my screencap. That’s the WordPress documentation on General Settings.

    Our code gets the URL directly from the settings in WP using the get_bloginfo( ‘url’ ) and site_url functions.

    ‘url’ – The Site address (URL) (set in Settings > General)

    Thread Starter chexone

    (@chexone)

    Thank you for the detailed information. I was able to trace through the code. It looks like site_url() is not returning https as the default scheme.

    If I force site_url() to use https, then the ajax update works in the admin.

    all_in_one_seo_pack.php

    if ( ! defined( 'WP_ADMIN_URL' ) ) {
    	define( 'WP_ADMIN_URL', site_url('','https') . '/wp-admin' );
    }

    Sounds like I need to figure out why site_url() is returning the http scheme rather than https.

    Thread Starter chexone

    (@chexone)

    I traced the root cause of this to is_ssl() not working on my system. Probably because of the load balancer. If I force is_ssl() to return true, the problem goes away. Nothing wrong with the plugin, thanks for the help.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Ajax edit does not work because it’s not https’ is closed to new replies.