My live preview isn't loading. I'm getting the following error:

Mixed Content: The page at 'https://www.site.com/admin/entries/pages/611-title' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://www.site.com/path/title?token=lxDnfeMzRFOM-xI2IylUQZ2r1XkiQlgR'. This request has been blocked; the content must be served over HTTPS

I'm not sure where the http request is coming from though. My env file sets the site url using https, and the Base URL in settings > sites also uses https. Is there another location where Craft could be getting the http from?

UPDATE: I tweaked my htaccess settings, and now I'm getting a different error: [Error] Failed to load resource: the server responded with a status of 500 () (page-title, line 0) https://www.example.com/path/page-title?token=zVyQLpLN9K8fZ9FJKYf6Y6l9gEvHAWts If I try to access the url in the error, I get a HTTP 400 – Bad Request – yii\web\BadRequestHttpException error

  • Maybe a rewrite in the .htaccess file? – Brad Bell Apr 11 '19 at 23:29
  • @BradBell I updated my .htaccess and now I'm getting a 500 error (see update to my original post) – artmem Apr 12 '19 at 18:48

I had the same issue!

In my case, it was because I had defined http://example.com as my siteUrl for the production environment, in my general.php config file. Simply changing this to https://example.com fixed it!

Sample code: (Change 'production' to match the env you are targeting of course)

'production' => [
    // Base site URL (if multisite)
    'siteUrl' => [
        'mysite!' => 'https://example.ca',
    //OR Base site URL (if single site)
    'siteUrl' => 'https://example.ca'

More on the general.php config file: https://docs.craftcms.com/v3/config/config-settings.html

| improve this answer | |

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.