changing from http:// to https://

emergingdzns - 8 months ago

I now need to get SSL going on my site. I've installed the certs and everything that is needed. When I attempt to load the site on https:// all of the styles are trashed because Chrome won't load any http:// resources. But the {{ asset_add }} command is inserting the path to the css as http://, not https:// like it should when I'm viewing the site in secure mode. What am I missing? Is there a hidden setting somewhere that makes the site respond correctly to the protocol?

Answer

- 8 months ago

What's your environment look like? Try researching HTTPS not being detected by Laravel cause that's exactly what's happening here - it's going to be an environment configuration issue somewhere.

william - 8 months ago

Interesting. My site worked directly without any hassle.

ryanthompson - 8 months ago

What's your environment look like?

You are using asset_path in your assets right? Not URL? You don't want assets to compile with environmental detail like http/s.

emergingdzns - 8 months ago

Not either of those. The issue is in the theme partial for the meta info. It's like this:

{{ asset_add("theme.js", "theme::js/jquery.nivo.slider.js", ["parse"]) }}
{{ asset_add("theme.js", "theme::js/cart_actions.js", ["parse"]) }}
{{ asset_add("theme.js", "theme::js/pnotify.custom.min.js", ["parse"]) }}
{{ asset_script("theme.js") }}

{{ asset_add("theme.css", "theme::css/nivo/nivo-slider.css", ["parse"]) }}
{{ asset_add("theme.css", "theme::css/nivo/themes/light/light.css", ["parse"]) }}
{{ asset_add("theme.css", "theme::font-awesome/css/font-awesome.css", ["parse"]) }}
{{ asset_add("theme.css", "theme::css/pnotify.custom.min.css", ["parse"]) }}

{{ asset_add("theme.css", "theme::css/custom.css") }}

{{ asset_style("theme.css") }}

When output into the browser it looks like this:

<script src="http://my.domain.com/app/default/assets/public/theme.js"></script>

<link media="all" type="text/css" rel="stylesheet" href="http://my.domain.com/app/default/assets/public/theme.css">

Thanks!

ryanthompson - 8 months ago

What's your environment look like? Try researching HTTPS not being detected by Laravel cause that's exactly what's happening here - it's going to be an environment configuration issue somewhere.

emergingdzns - 8 months ago

Ahhhhh. I never thought of that! Thanks!