Set no cache for index.html

pull/98/merge
Doflatango 2018-03-09 15:25:10 +08:00
parent 36c2198f47
commit 75c9a83b13
4 changed files with 20 additions and 14 deletions

View File

@ -1,6 +1,9 @@
#!/bin/sh
BASEDIR=$(dirname "$0")
BASEDIR=$(dirname $(realpath $0))
cd $BASEDIR/ui
npm run build
cd ..
go-bindata -pkg "web" -prefix "ui/dist/" -o static_assets.go ./ui/dist/
VER=$(git rev-parse --short HEAD)
sed -i '' -E "s/(build\.js\?v=).{7}/\1${VER}/g" $BASEDIR/ui/index.html

View File

@ -144,6 +144,9 @@ func (s *embeddedFileServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
fp += s.IndexFile
w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
w.Header().Set("Expires", "0")
b, err = Asset(fp)
if err == nil {
w.Write(b)

File diff suppressed because one or more lines are too long

View File

@ -61,7 +61,7 @@
<div id="app">
<div id="initloader"></div>
</div>
<script src="build.js"></script>
<script src="build.js?v=36c2198"></script>
</body>
</html>