It’s easy. Don’t use absolute URLs. Load CSS and JS like: <link rel="stylesheet" href="/css/main.min.1ebc855198758cc89974d5f06291d80bb680d6ca0c8687cba08285295f8eefca.css" />, that is, relative to the domain.
Hey there! I’m experiencing the same issue, but I built my website using th static site generator Hugo, and this is the only topic I found about this issue anywhere. Do you have any idea on how to solve this in Hugo?
@Soverain do you mind sharing your repo so we can have a look?
In general terms, you should use .RelPermalink instead of .Permalink, and .relURL instead of .absURL. But, we can find the exact cause if we see the repo.
@Soverain, have you tried changing the baseURL in your config.toml file to match your custom domain (like www.example.com)? For example, this might be:
baseURL = "https://www.example.com/"
Please let us know if that doesn’t work or if there are other questions.
Hi, @hrishikesh,
actually, my site also is built on Hugo.
What I did was to regenerate JS files (I’m using Gulp) and also what I did was to remove Subresource Integrity (SRI) from my Script tags: https://share.getcloudapp.com/xQuABK5e
That’s a good way, but, someone might want to keep the SSI on the script tags and also might not be experienced with using Node Modules and Gulp or might want not want to use it at all (I’m one of these people ).
Hi guys! Thank you very much for your help! It was indeed the domain name, my baseURL was set to the previous one, pointing on netlify’s domain name. Now everything is working fine.
For reference, the theme I picked already use .RelPermalink. Another fix I tried was to set the crossorigin to "anonymous". It did not work though.