Page 1 of 1
[FIXED] Mixed content errors breaking order updates
Posted: Thu Jul 28, 2016 12:43 pm
by karak
OC version 2.2.0.0
I just did a new install of opencart and wanted to run-through the process of ordering an item, processing that order, etc - to familiarize myself with the application. Placing the order went easily enough, but when I tried to update the status of that order I got an error - a pop up window that said 'error undefined'. The developer tools console shows mixed content errors:
Code: Select all
jquery-2.1.1.min.js:4 Mixed Content: The page at 'https://www.example.com/store/admin/index.php?route=extension/installer&token=cGp1sGTV0LcBnj8q4bvMHOgNaYKIz5pg' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://www.example.com/store/admin/index.php?route=extension/installer/unzip&token=cGp1sGTV0LcBnj8q4bvMHOgNaYKIz5pg'. This request has been blocked; the content must be served over HTTPS.
Code: Select all
XMLHttpRequest cannot load http://www.example.com/store/admin/index.php?route=extension/installer/unzip&token=cGp1sGTV0LcBnj8q4bvMHOgNaYKIz5pg. Failed to start loading.
I'm running this on apache2 and I have an ssl redirect on the :80 vhost to force everything to https, and I'm hoping someone can tell me how to fix these calls so that the endpoints reference https instead as I think that would resolve these errors and maybe my issues with installing extensions and updating orders.
Like I said this is a brand new install so if it's easiest to start over that's not an issue.
Re: Mixed content errors breaking ext. install and order upd
Posted: Thu Jul 28, 2016 12:59 pm
by Qphoria
This means you are forcing your htaccess to load "https" but your config.php file for HTTP_SERVER and/or HTTPS_SERVER is set to "http"
Re: Mixed content errors breaking ext. install and order upd
Posted: Thu Jul 28, 2016 1:13 pm
by karak
Qphoria wrote:This means you are forcing your htaccess to load "https" but your config.php file for HTTP_SERVER and/or HTTPS_SERVER is set to "http"
First off thanks for the very quick response!
I looked in my config.php and see these lines:
Code: Select all
// HTTP
define('HTTP_SERVER', 'https://www.example.com/store/');
// HTTPS
define('HTTPS_SERVER', 'https://www.example.com/store/');
Re: Mixed content errors breaking ext. install and order upd
Posted: Thu Jul 28, 2016 1:33 pm
by karak
I found this snippet in another thread:
Re: Https Mixed content error
If this is 2.2.0.0:
Look in upload/system/config/catalog.php and upload/system/config/admin.php.
Set
$_['site_ssl'] = false;
to
$_['site_ssl'] = true;
by budgetneon
Thu Mar 17, 2016 5:53 am
and that resolved my extension installation issue, but the order update still seems to be busted... I did notice this error:
Code: Select all
jquery-2.1.1.min.js:4 XMLHttpRequest cannot load httpss://www.thehoneystraw.com/store/index.php?route=api/login. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.k.cors.a.crossDomain.send @ jquery-2.1.1.min.js:4n.extend.ajax @ jquery-2.1.1.min.js:4(anonymous function) @ index.php?route=sale/order/info&token=iONFFrxf86qwp7neArj2MpvpRTPgtDiz&order_id=1:672
Any idea why the protocol identifier is 'httpss' ?
Re: Mixed content errors breaking ext. install and order upd
Posted: Thu Jul 28, 2016 1:51 pm
by karak
Re: Mixed content errors breaking ext. install and order upd
Posted: Thu Jul 28, 2016 7:54 pm
by labeshops
Thank you!! That also fixed my problem with the permission denied on the api!!
Re: [FIXED] Mixed content errors breaking order updates
Posted: Thu Jul 28, 2016 9:15 pm
by straightlight
Thank you all for your feedbacks. I wlll add this to the docs.
Re: [FIXED] Mixed content errors breaking order updates
Posted: Thu Jul 28, 2016 9:18 pm
by straightlight
A sticky topic has now been created in the Bug Reports section of the forum:
http://forum.opencart.com/viewtopic.php?f=191&t=165865 so for all users to notice the current fix.
Re: Mixed content errors breaking ext. install and order upd
Posted: Thu Jul 28, 2016 10:40 pm
by karak
labeshops wrote:
Thank you!! That also fixed my problem with the permission denied on the api!!
Good stuff!
Re: Mixed content errors breaking ext. install and order upd
Posted: Sat Jul 30, 2016 1:56 am
by samsotiriadis
Finally some excellent progress!
Is there any chance this could work / adjusted for 2.0.1.1 version too?
Re: Mixed content errors breaking ext. install and order upd
Posted: Sat Jul 30, 2016 2:04 am
by straightlight
samsotiriadis wrote:
Finally some excellent progress!
Is there any chance this could work / adjusted for 2.0.1.1 version too?
Simply look for the mentioned lines on the same source files mentioned from the GitHub link and see if you can replace the entries accordingly.

Re: [FIXED] Mixed content errors breaking order updates
Posted: Sat Jul 30, 2016 2:52 am
by samsotiriadis
Have done and the file structure is rather different.
Re: [FIXED] Mixed content errors breaking order updates
Posted: Sat Jul 30, 2016 3:39 am
by straightlight
samsotiriadis wrote:Have done and the file structure is rather different.
It would, then, be suggested to upgrade to the latest version of Opencart before applying these changes.
Re: [FIXED] Mixed content errors breaking order updates
Posted: Mon Aug 01, 2016 9:20 pm
by samsotiriadis
No need. Thanks to some chaps here that fixed this and working on 2.0.1.1
Cheerio
Re: [FIXED] Mixed content errors breaking order updates
Posted: Sat Aug 20, 2016 5:59 am
by EvolveWebHosting
Thanks for the fix. That was annoying!
Re: [FIXED] Mixed content errors breaking order updates
Posted: Thu Oct 06, 2016 6:05 pm
by 19ninety
What do I need to replace, I've looked through orders.php and can't find the line I'm supposed to remove as highlighted on github:
Code: Select all
$data['store_url'] = $this->request->server['HTTPS'] ? preg_replace("/^http:\/\//", "https://", $order_info['store_url']) : $order_info['store_url'];
so I've added:
Code: Select all
$data['store_url'] = $this->request->server['HTTPS'] ? HTTPS_CATALOG : HTTP_CATALOG;
at line 851, uploaded, refreshed but still get the API error when I try to change the order status. Using Version 2.1.0.1
Re: [FIXED] Mixed content errors breaking order updates
Posted: Fri Oct 07, 2016 3:00 pm
by 19ninety
Any ideas anyone?
Re: [FIXED] Mixed content errors breaking order updates
Posted: Sun Oct 30, 2016 5:47 pm
by 19ninety
Installing Prestashop fixed this for me. Cya OpenCart, it's been ..... "educational".
Re: [FIXED] Mixed content errors breaking order updates
Posted: Sun Oct 30, 2016 6:46 pm
by cyclops12
19ninety wrote:Installing Prestashop fixed this for me. Cya OpenCart, it's been ..... "educational".
Good luck with prestashop.....but be aware you will still have problems when you come to upgrade......just read ps forums
