Custom ETag algorithm for asset fingerprinting

2019-03-03 12:14发布

How to specify the ETag algorithm used for asset fingerprinting in Play without using third-party plugins?

For example, specify that the ETag is to be the environment variable BUILD_NUMBER, the GitHub revision number of the file, and its time/date? To know how to do the GitHub revision bit would be really great. :)

Related questions: Embed ETag in URL & Automatically Insert ETag (asset fingerprinting) as comment at top of the resource

1条回答
时光不老,我们不散
2楼-- · 2019-03-03 13:04

At present there is no configuration possibility to specify what ETag algorithm to use with the Play API.

The Assets class can be extended and overridden to keep all the benefits of the aggressive caching that Play does when changing the ETag algorithm.

The BUILD_NUMBER can be passed in to the algorithm and the GitHub API can be used to obtain the revision number for any file.

查看更多
登录 后发表回答