JavaScript does not load after adding custom domain


my Netlify site sat under
I just added a custom domain:

Page loads, but no JavaScript. Console says:

Subresource Integrity: The resource ‘’ has an integrity attribute, but the resource requires the request to be CORS enabled to check the integrity, and it is not. The resource has been blocked because the integrity cannot be enforced.

Any ideas how to get JS to load?

1 Like

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.

1 Like

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.

Hi, @mnisn. I don’t see any text in your comment.

@Soverain, have you tried changing the baseURL in your config.toml file to match your custom domain (like For example, this might be:

baseURL = ""

​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:

That helped to load JS on my custom domain.

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 :laughing:).

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.