1

I've got a site in SSL but when I visit the Control panel it is completely unstyled and looking in the inspector I see a mixed content error and js/css is being blocked.

Not sure why this is happening, but in case it's relevant am using FocusLab Master Config for EE3

**** UPDATE *****

I added this to config.prod.php and no change

$env_config['cp_url'] = 'https://www.domain.com/admin.php';

**** UPDATE 2 ****

This is in response to @jrothafer about the config settings. Here is the relevant code from config.master.php

$protocol = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://';
$base_url = $protocol . $_SERVER['HTTP_HOST'];
$base_path = $_SERVER['DOCUMENT_ROOT'];
3
  • What's your control panel URL set to in the config? Jun 15, 2016 at 13:30
  • Steven: $env_config['cp_url'] = $env_config['base_url'] . '/admin.php'; Also updated post with additional info
    – CreateSean
    Jun 15, 2016 at 13:32
  • when you look at the source of the control panel - can you see what's loading over http:// ? Jun 15, 2016 at 13:42

2 Answers 2

4

This is always a themes folder and protocol issue, I've found. You mentioned this:

$env_config['cp_url'] = $env_config['base_url'] . '/admin.php';

What are you parameters for various $env_config array entries? Make sure that array is using https for that URL, and also your themes folder must also be behind SSL.

Update

Hey, so are you forcing SSL for all connections? If not, you should be! Otherwise,

$protocol = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://';
$base_url = $protocol . $_SERVER['HTTP_HOST'];
$base_path = $_SERVER['DOCUMENT_ROOT'];

This set up will respect the HTTP protocol request and load assets over plain HTTP. You need to force that SSL! Best using .htaccess rules, or equivalent nginx rules:

RewriteCond %{HTTP_HOST} ^mydomain\.com$ [NC]
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://mydomain.com/ [R=301,L]
4
  • See update 2 for additional info.
    – CreateSean
    Jun 15, 2016 at 13:45
  • Force that https! Edited.
    – jrothafer
    Jun 15, 2016 at 13:53
  • that's what i do Jun 15, 2016 at 13:58
  • jrothafer, I added your htaccess code and this solved part of the issue. but I'm still getting mixed content inside the CP on the publish page when trying to upload images. domain.com/?ACT=45 is being blocked cause it's not loading on https. Any suggestions?
    – CreateSean
    Jun 17, 2016 at 13:56
0

With help from @jrothafers answer. I hardcoded the themes path in config.master.php and it's working now.

$env_config['theme_folder_url'] = https://www.domain.com/themes/';

Ideally I wouldn't have to do that, but it works.

1
  • Yay! I updated my answer, but do I win the tacos for my answer?
    – jrothafer
    Jun 15, 2016 at 13:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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