rhazdon / hugo-theme-hello-friend-ng

Pretty basic theme for Hugo that covers all of the essentials. All you have to do is start typing!
https://github.com/rhazdon/hugo-theme-hello-friend-ng/
Other
1.46k stars 769 forks source link

CSS not rendering, because of CORS not enabled error #423

Closed 0phoi5 closed 1 year ago

0phoi5 commented 1 year ago

Please see https://www.jackcollins.me.uk/ (currently 10th April 2023), specifically the Developer Console.

The site's CSS does not render, because of the following error in console; "Subresource Integrity: The resource 'https://jackcollins.me.uk/main.fdbf67c1c5b35c383c80cfa6498f36263db3d5b9c48a7b6b50bc7e7249d8e12c.css' 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."

The same error occurs if I replace the baseURL with https://jackcollins.me.uk/ or https://www.jackcollins.me.uk/ or just /.

The site renders fine locally (hugo serve).

Note that the site is hosted via AWS Amplify, and I have https://jackcollins.me.uk forwarding to https://www.jackcollins.me.uk

rhazdon commented 1 year ago

Hey @0phoi5 :)

What's your value for baseURL in your config.toml?

0phoi5 commented 1 year ago

Hey @0phoi5 :)

What's your value for baseURL in your config.toml?

Hi rhazdon,

At the moment, it's baseURL = "https://jackcollins.me.uk/" I've tried uploading with that, plus baseURL = "https://www.jackcollins.me.uk/", as well as baseURL = "/", none worked, same error seen in console.

0phoi5 commented 1 year ago

If it helps, here is the current code; https://github.com/0phoi5/jackcollins.me.uk

0phoi5 commented 1 year ago

It seems this may cover the solution, but would require an update to the Template's link rel for loading stylesheets; https://codinginthetrenches.com/2021/06/26/cross-origin-headers-cors-aws-s3-and-aws-cloudfront/

For example; <link rel="stylesheet" href="https://jackcollins.me.uk/main.b78c3be9451dc4ca61ca377f3dc2cf2e6345a44c2bae46216a322ef366daa399.css" integrity="sha256-t4w76UUdxMphyjd/PcLPLmNFpEwrrkYhajIu82bao5k="> needs to be... <link rel="stylesheet" href="https://jackcollins.me.uk/main.b78c3be9451dc4ca61ca377f3dc2cf2e6345a44c2bae46216a322ef366daa399.css" integrity="sha256-t4w76UUdxMphyjd/PcLPLmNFpEwrrkYhajIu82bao5k=" crossorigin="anonymous"> ... and the same for the rest of the link rel="stylesheet" references, as well as the Githubissues.

  • Githubissues is a development platform for aggregating issues.