0

I have just switched our sites over to use SSL and they are working however I am seeing this in the console...

Mixed Content: The page at 'https://www.mysite.co.uk/' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://www.mysite.co.uk/customer/section/load/?sections=cart&update_section_id=false&_=1506870648904'. This request has been blocked; the content must be served over HTTPS.

/pub/static/frontend/name/theme/en_GB/Magento_Customer/js/customer-data.js:86 Uncaught Error: [object Object]
at Object.<anonymous> (/pub/static/frontend/name/theme/en_GB/Magento_Customer/js/customer-data.js:86)
at fire (/pub/static/frontend/name/theme/en_GB/jquery.js:3099)
at Object.fireWith [as rejectWith] (/pub/static/frontend/name/theme/en_GB/jquery.js:3211)
at done (/pub/static/frontend/name/theme/en_GB/jquery.js:9312)
at XMLHttpRequest.callback (/pub/static/frontend/name/theme/en_GB/jquery.js:9720)

I also have a separate store view which is also using SSL and they are setup pretty much identical, yet that site does not have this error.

All of my urls in admin>configuration>web are https

Can anyone point me in the right direction please?

Magento 2.1.4

  • Have you check your core_config_data table and check any value at value coloumn exits with http://www.mysite.co.uk/? – Amit Bera Oct 1 '17 at 15:43
  • Lifesaver thank you - there was still a http entry for web/secure/base_link_url in core_config_data - thanks for your help – Richard Laws Oct 1 '17 at 15:54
3

You should check this

This 4 fields values at core_config_data database table.

  • Base URL: web/unsecure/base_url
  • Base Link URL: web/unsecure/base_link_url
  • Secure Base URL: web/secure/base_url
  • Secure Base Link URL: web/secure/base_link_url

Check this 4 field value should start with https

enter image description here

  • Thanks - in admin they looked correct but in the database it didnt - weird - solved thanks – Richard Laws Oct 2 '17 at 11:54
0

try to paste this in your index.php

if( isset($_SERVER['HTTP_X_FORWARDED_PROTO']) ) {
    $_SERVER['HTTPS'] = 'on';
    $_SERVER['SERVER_PORT'] = 443;
}

or

if( isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
$_SERVER['HTTPS'] = 'on';
$_SERVER['SERVER_PORT'] = 443;
}

got it here.

Happy Coding

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.