我想发布文件manifest.webmanifest
在 Laravel Vapor 上。我尝试在根域( docs )上提供它:
# vapor.php
...
'serve_assets' => ['manifest.webmanifest'],
...
Vapor 处理该路由,但抛出异常:
Client error: `GET https://xxxx.cloudfront.net/xxx/manifest.webmanifest` resulted in a `404 Not Found` response:
经过进一步检查,这是合乎逻辑的,因为文件永远不会发送到 S3 存储桶。看来Laravel/VaporCli/AssetFiles
过滤类似 *.webmanifest
的文件, manifest.json
和mix-manifest.json
.
不知道为什么要这样做。有人有办法完成这项工作吗?
最佳答案
一位开发 Vapor 的开发人员 replied并表示现在不可能改变它,因为这将是一个突破性的改变。他建议添加一条返回 list 内容的路由。
我已将此路线添加到我的项目中:
Route::middleware('cache.headers:public;max_age=7200')->get(
'/manifest.webmanifest',
function (): string {
return file_get_contents(public_path('manifest.webmanifest'));
}
)
关于php - 如何使用 Laravel Vapor 发布 list 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66065225/