Reputation: 137
I just moved the static files of my Django project into AWS S3. It works so far. But my .css files contain relative paths, for example to fonts, for example:
@import "variables";
@font-face {
font-family: '#{$font-family}';
src: url('#{$font-path}/#{$font-family}.eot?4zay6m');
format('svg');
font-weight: normal;
font-style: normal;
}
My browser console shows that the path to these file is set correctly, for example
https://mybucket.s3.amazonaws.com/static/plugins/fonts/myfont.ttf?4zay6m
but I get a permission denied, because unlike the other (from django set paths), these paths do not contain the "Amazon stuff" after the question mark like
https://mybucket.s3.amazonaws.com/static/js/jquery.tablednd.js?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=XXXXXXX
Is there a simple workaroud?
Thanks in advance.
Upvotes: 1
Views: 790
Reputation: 9301
You can do solve your problem using :
Your S3 is not public static hosting to access without Access token of AWS account.
For example how to do S3 bucket as hosting see this blog : https://www.internetkatta.com/host-angular-2-or-4-or-5-version-in-aws-s3-using-cloudfront
Upvotes: 1