简体   繁体   中英

How to publish a manifest file with Laravel Vapor

I would like to publish the file manifest.webmanifest on Laravel Vapor. I've tried to serve it on the root domain ( docs ):

# vapor.php
...
    'serve_assets' => ['manifest.webmanifest'],
...

Vapor handles that route, but throws an exception:

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. It appears that Laravel/VaporCli/AssetFiles filters files like *.webmanifest , manifest.json and 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. 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'));
    }
)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM