php - 如何使用 Laravel Vapor 发布 list 文件

标签 php laravel laravel-vapor

我想发布文件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.jsonmix-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/

相关文章:

php写入文件权限问题

php - Facebook PHP-SDK getUser() 始终返回 0

css - 如何在 Vue-js 中添加 css 图像背景,以便 Laravel Vapor 可以将 url 重写为正确的 S3/CDN url

swift - 无法与主机 smtp.googlemail.com 建立连接

php - 如何在 Laravel 4 中注入(inject)多个共享相同接口(interface)的类

laravel - AWS SQS 异常 "413 Request Entity Too Large"

laravel - Laravel Vapor 环境上 SingleStore 托管实例的 SSL 证书

php - 我想在sql中的两个日期之间搜索

javascript - 使用 jsonp 和 php 返回回调

php - Laravel Passport 密码授予刷新 token