I've recently added an SSL to the site I'm working on, and it seems to have broken my "load more" buttons via sprig. When I click the button now, I get
Blocked loading mixed active content “http://mydomainname.net/index.php?p=actions/sprig/components/render&offset=6&sprig%3AsiteId=32200a47f3a91660d5c53896017cd9e51baccf7f69c571407279fa99ecbcffb91&sprig%3Atemplate=0fb8ec651fc53258017209d22d4e19b6143ac209993784d01a06801fd13e9cd6_layouts%2F_blog%2F_loadMore&sprig%3Avariables%5Blimit%5D=15a1fe68dab9e8d01fdd3bc84980fa5d354e5c72f0e00d06e0841462638f363d6”
and
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://www.mydomainname.net/index.php?p=actions/sprig/components/render&offset=6&sprig%3AsiteId=32200a47f3a91660d5c53896017cd9e51baccf7f69c571407279fa99ecbcffb91&sprig%3Atemplate=0fb8ec651fc53258017209d22d4e19b6143ac209993784d01a06801fd13e9cd6_layouts%2F_blog%2F_loadMore&sprig%3Avariables%5Blimit%5D=15a1fe68dab9e8d01fdd3bc84980fa5d354e5c72f0e00d06e0841462638f363d6. (Reason: CORS request did not succeed).
errors in my console. I've noticed that the cross origin error is trying to load stuff over https but the mixed active content error is trying to load over http.
How can I get this working again over https?
Here's my sprig code if you need it:
{{ sprig('_layouts/_blog/_loadMore', {'limit': 6}) }}
{{ sprig.script }}
{% set offset = offset ?? 0 %}
{% set entryQuery = craft.entries.section('diggingDeeper').offset(offset).limit(limit) %}
{% set entries = entryQuery.all() %}
{% for entry in entries %}
----Entry Stuff----
{% endfor %}
{% if entryQuery.count() > offset + entries|length %}
<button class="orange-button" sprig s-val:offset="{{ offset + limit }}"
s-target="this" s-swap="outerHTML">
<p>Load More</p>
</button>
{% endif %}
Edit: Added the full errors
Got it figured out, full answer HERE. Long story short, there were two problems.
.htaccess
file, I was forcing the removal of www
from my
domain. That code was calling up http
instead of https
. Adding
the "s" resolved one of the errors.www
in my .htaccess
file, my root domain was still using www
, which caused an error. So removing www
from my root domain fixed the second error.