I'm running Craft CMS 3.3.11 on an EC2 machine with Apache and Load Balancer.
After upgrading to Craft 3, I'm having issues with caching.
I use relative paths to resources/assets in my templates (i.e. href="/resources/logo.svg"
After some time, the relative paths in the template are not handled properly - instead of domain name in the URLs I get the server's IP address. It's impossible to fetch data using IP address, so the website is loading forever, the assets won't show up and it logs an error to the dev console:
Mixed Content: The page at ‘https://example.com/’ was loaded over HTTPS, but requested an insecure image ‘http://172.xx.xx.xx/cpresources/8f9c0f5e/logo.svg?v=1572966078’. This content should also be served over HTTPS.
When I clear caches, everything works properly again.
Adding {{ siteUrl }}
before all the relative paths seems to be the easiest fix, but I wonder if maybe I have some configuration issues that should be fixed to prevent this in future?
Server's IP isn't stored neither in the database nor the template files - where does it come from?
Suggestions?
EDIT
Unfortunately it still doesn't work properly.
Here's my code:
<img src="{{ craft.rebrand.getLogo().url }}" alt="{{ siteName }}"
class="brand-logo">
{% endif %}
{% if craft.rebrand.isIconUploaded() %}
<img src="{{ craft.rebrand.getIcon().url }}" alt="{{ siteName }}"
class="brand-icon">
{% endif %}
For these assets Craft is using server's IP... Can someone please advise?