[英]How to publish a manifest file with Laravel Vapor
I would like to publish the file manifest.webmanifest
on Laravel Vapor.我想在 Laravel Vapor 上发布文件
manifest.webmanifest
。 I've tried to serve it on the root domain ( docs ):我尝试在根域 ( docs ) 上提供它:
# vapor.php
...
'serve_assets' => ['manifest.webmanifest'],
...
Vapor handles that route, but throws an exception: Vapor 处理该路由,但抛出异常:
Client error: `GET https://xxxx.cloudfront.net/xxx/manifest.webmanifest` resulted in a `404 Not Found` response:
After further inspection this is logical, because the file is never send to the S3 bucket.进一步检查后,这是合乎逻辑的,因为文件永远不会发送到 S3 存储桶。 It appears that
Laravel/VaporCli/AssetFiles
filters files like *.webmanifest
, manifest.json
and mix-manifest.json
. Laravel/VaporCli/AssetFiles
似乎过滤了*.webmanifest
、 manifest.json
和mix-manifest.json
等文件。
No clue why it does that.不知道为什么这样做。 Does anyone have a trick to get the job done?
有没有人有技巧来完成工作?
A developer working on Vapor replied and said changing it isn't possible right now because it will be a breaking change.一位从事 Vapor 开发的开发人员回答说,现在不可能改变它,因为这将是一个破坏性的改变。 He suggests adding a route that returns the content of the manifest.
他建议添加一个返回清单内容的路由。
I've added this route to my project:我已将这条路线添加到我的项目中:
Route::middleware('cache.headers:public;max_age=7200')->get(
'/manifest.webmanifest',
function (): string {
return file_get_contents(public_path('manifest.webmanifest'));
}
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.