HTTPS/HTTP issues when loading styles and scripts

Dear all. I’m having troubles loading assets with the default Kirby starter in my environment. I have my site working, but it doesn’t seem to pick up correct asset paths—keeps loading styles and scripts over http. Unsure where to look, whether that’s my SSL config issues (the site runs on a Fedora machine in EC2), or .htaccess or what not. Please advise.

Welccome!

It not just the CSS and JS, all your page links urls are on HTTP as well. the SSL certificate doesnt seem right. I would probably start there. My web browser is warning the connection is not secure, i think because you have a mix of http and https content on the page. Digging into the certificate details, the certificate isnt verified.

you can force https redirects in the .htaccess like this

RewriteCond %{HTTP_HOST} !=localhost
RewriteCond %{HTTP_HOST} ^www\. [NC,OR]
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [R=301,L,NE]

Im not really an expert in SSL certificates, but something doesnt seem right with the instalation. I would check there first.

Thanks @jimbobrjames! Your insight is much appreciated. It’s very likely I mixed something up while setting up the EC2 instance. AWS setup is always one massive pain to get right. I’ll go over the process more carefully and see if I can make it work. :crossed_fingers:t2:

Some hosts give a basic temporary SSL certificate, i know the Plesk panel does, but its not like a “full” certificate… i think this is what AWS have given you.

If your not fussy about sticking with AWS, i can recommend FortRabbit as an excellent host for Kirby, and its built on top of Amazons infrastucture. Just a suggestion of course.

I managed to fix my issue. It was enough to enforce Kirby to use https by setting the url variable in the config file. AWS’s Load Balancer was inconsistently redirecting to https, while Kirby kept requesting assets via http. Any browser would get confused by this.

@jimbobrjames Thanks again. Had a look at FortRabbit. Looks interesting!