Wordpress W3总缓存:在基于AWS S3的CDN中未找到缩小的CSS和JS文件
我的配置包括Wordpress安装的W3 Total Cache插件,该插件设置为在CDN(Amazon S3+Cloudfront)上缓存资源 HTML资源和图像加载正确,但问题在于缩小了CSS和JS,因为它们被插件重命名(例如Wordpress W3总缓存:在基于AWS S3的CDN中未找到缩小的CSS和JS文件,wordpress,amazon-web-services,amazon-s3,amazon-cloudfront,w3-total-cache,Wordpress,Amazon Web Services,Amazon S3,Amazon Cloudfront,W3 Total Cache,我的配置包括Wordpress安装的W3 Total Cache插件,该插件设置为在CDN(Amazon S3+Cloudfront)上缓存资源 HTML资源和图像加载正确,但问题在于缩小了CSS和JS,因为它们被插件重命名(例如style.CSS重命名为18704.CSS) 问题可能在于我如何在站点的HTML代码中编写URI,其中引用的是原始的style.css,而不是生成的文件名: <link rel='stylesheet' id='wptheme-style-css' href=
style.CSS
重命名为18704.CSS
)
问题可能在于我如何在站点的HTML代码中编写URI,其中引用的是原始的style.css
,而不是生成的文件名:
<link rel='stylesheet' id='wptheme-style-css' href='https://<distribution_id>.cloudfront.net/wp-content/themes/wptheme/style.css.gzip?ver=1.0.1' type='text/css' media='all' />
- 存储在S3存储桶中的文件具有正确的MIME类型,尽管有些文件可能缺少CORS策略:
S3存储桶中实际缩小和压缩的CSS和JS文件:
您找到解决方案了吗?
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::bucketname/*"
}
]
}
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<AllowedHeader>*</AllowedHeader>
</CORSRule>
</CORSConfiguration>
wp-signup.php:1 Uncaught SyntaxError: Unexpected token <
wp-signup.php:1 Uncaught SyntaxError: Unexpected token <
wp-signup.php:1 Uncaught SyntaxError: Unexpected token <
(index):96 Uncaught ReferenceError: jQuery is not defined
at (index):96
(anonymous) @ (index):96
www.example.com/:199 Uncaught ReferenceError: jQuery is not defined
at (index):199
(anonymous) @ (index):199
www.example.com/:1353 Uncaught ReferenceError: jQuery is not defined
at (index):1353
(anonymous) @ (index):1353
wp-signup.php:1 Uncaught SyntaxError: Unexpected token <
wp-signup.php:1 Uncaught SyntaxError: Unexpected token <
wp-signup.php:1 Uncaught SyntaxError: Unexpected token <
wp-signup.php:1 Uncaught SyntaxError: Unexpected token <
wp-signup.php:1 Uncaught SyntaxError: Unexpected token <
wp-signup.php:1 Uncaught SyntaxError: Unexpected token <
wp-signup.php:1 Uncaught SyntaxError: Unexpected token <
wp-signup.php:1 Uncaught SyntaxError: Unexpected token <
wp-signup.php:1 Uncaught SyntaxError: Unexpected token <
wp-signup.php:1 Uncaught SyntaxError: Unexpected token <
wp-signup.php:1 Uncaught SyntaxError: Unexpected token <
wp-signup.php:1 Uncaught SyntaxError: Unexpected token <
wp-signup.php:1 Uncaught SyntaxError: Unexpected token <
twitter-widgets.js.gzip Failed to load resource: the server responded with a status of 403 ()
wp-signup.php:1 Uncaught SyntaxError: Unexpected token <
wp-signup.php:1 Uncaught SyntaxError: Unexpected token <