我对在Cloud Front上部署React Application有一些疑问。
Cloud Front上托管的前端网站的缓存和更新如何工作?
When I upload a new files to the bucket I will see the changes IMEDIATELY after accessing the site again? If not, how long it will take?
I need to make an invalidate request to see the changes working on the website? If yes, how long it will take?
在Cloud Front中处理缓存和更新单页应用程序的最佳方法是什么? (我正在使用React Application和Webpack)
答案 0 :(得分:0)
您需要做的是清除存储桶的缓存或“使文件无效”。
https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Invalidation.html
因此,安装aws cli并运行以下命令:
public func loadForecast(for city: City, callback: @escaping (_
response:WeatherResponse?, _ error:LoadingError?) -> () ) {
**guard let cityId = city.id else** {
callback(nil, LoadingError.invalidCity)
return
}
我建议您使用S3存储桶进行开发。