【问题标题】:How to publish a manifest file with Laravel Vapor如何使用 Laravel Vapor 发布清单文件
【发布时间】:2021-05-09 21:50:55
【问题描述】:

我想在 Laravel Vapor 上发布文件 manifest.webmanifest。我尝试在根域 (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 过滤了*.webmanifestmanifest.jsonmix-manifest.json 等文件。

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

【问题讨论】:

    标签: php laravel laravel-vapor


    【解决方案1】:

    一位开发 Vapor replied 的开发人员说,现在无法更改它,因为这将是一个重大更改。他建议添加一个返回清单内容的路由。

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

    Route::middleware('cache.headers:public;max_age=7200')->get(
        '/manifest.webmanifest',
        function (): string {
            return file_get_contents(public_path('manifest.webmanifest'));
        }
    )
    

    【讨论】:

      猜你喜欢
      • 2017-08-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-02-27
      • 1970-01-01
      • 2017-06-14
      • 2016-11-13
      • 2017-03-31
      相关资源
      最近更新 更多