ttree/resourceshortener

公共资源的URL缩短器

0.1.0 2018-01-10 12:41 UTC

This package is not auto-updated.

Last update: 2024-09-14 03:28:33 UTC


README

此包允许为包静态资源创建“短链接”。

安装

composer require ttree/resourceshortener

配置

Neos:
  Flow:
    http:
      chain:
        process:
          chain:
            'Ttree.ResourceShortener:Shortener':
              componentOptions:
                sites:
                  'website':
                    'manifest.webmanifest':
                      resource: 'resource://Ttree.Website/Public/Manifest.webmanifest'
                      headers:
                        'Content-Type': application/manifest+json
                        'Cache-Control': max-age=2592000
                    'sw.js':
                      resource: 'resource://Ttree.Website/Public/Scripts/ServiceWorker.js'
                      headers:
                        'Content-Type': text/javascript

在配置中,website 是当前站点的根节点名称。使用此配置,Manifest.webmanifest 可在 https://domain.com/manifest.webmanifest 获取,ServiceWorker.jshttps://domain.com/manifest.webmanifest 获取。

您可以使用 headers 部分发送自定义HTTP头。

警告:出于性能原因,最好在您的HTTP服务器(Apache、Nginx、Caddy等)中配置重写。但有时您无法访问这些配置,因此此包可能很有用。

鸣谢

ttree ltd - neos solution provider 赞助开发。

我们尽力以满腔热情打造此包,我们开放赞助、支持请求等,请联系我们。

许可协议

MIT许可(MIT)。有关更多信息,请参阅 LICENSE