1

我想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.

不知道为什么会这样。有没有人有完成工作的诀窍?

4

1 回答 1

0

一位在 Vapor 上工作的开发人员回答说,现在不可能改变它,因为这将是一个突破性的改变。他建议添加一个返回清单内容的路由。

我已将此路线添加到我的项目中:

Route::middleware('cache.headers:public;max_age=7200')->get(
    '/manifest.webmanifest',
    function (): string {
        return file_get_contents(public_path('manifest.webmanifest'));
    }
)
于 2021-10-09T11:30:39.000 回答