1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-20 03:17:04 +00:00
Former-commit-id: 60d9b0d77693895fdfbebe83712e9cc1ee3f8f26
This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-07-17 12:03:20 +03:00
parent baeff3e80b
commit 0f79728c88
6 changed files with 59 additions and 33 deletions

View File

@@ -24,7 +24,7 @@ func newApp() *iris.Application {
AssetInfo: GzipAssetInfo,
AssetNames: GzipAssetNames,
AssetValidator: func(ctx iris.Context, name string) bool {
ctx.Header("Vary", "Accept-Encoding")
// ctx.Header("Vary", "Accept-Encoding")
ctx.Header("Content-Encoding", "gzip")
return true
},

View File

@@ -17,10 +17,11 @@ import (
var opts = iris.DirOptions{
IndexName: "/index.html",
PushTargets: map[string][]string{
"/": {
"/public/favicon.ico",
"/public/js/main.js",
"/public/css/main.css",
"/": { // Relative path without route prefix.
"favicon.ico",
"js/main.js",
"css/main.css",
// ^ Relative to the index, if need absolute ones start with a slash ('/').
},
},
Compress: false, // SHOULD be set to false, files already compressed.
@@ -30,7 +31,7 @@ var opts = iris.DirOptions{
AssetNames: GzipAssetNames,
// Required for pre-compressed files:
AssetValidator: func(ctx iris.Context, _ string) bool {
ctx.Header("Vary", "Content-Encoding")
// ctx.Header("Vary", "Content-Encoding")
ctx.Header("Content-Encoding", "gzip")
return true
},

View File

@@ -17,10 +17,11 @@ import (
var opts = iris.DirOptions{
IndexName: "/index.html",
PushTargets: map[string][]string{
"/": {
"/public/favicon.ico",
"/public/js/main.js",
"/public/css/main.css",
"/": { // Relative path without route prefix.
"favicon.ico",
"js/main.js",
"css/main.css",
// ^ Relative to the index, if need absolute ones start with a slash ('/').
},
},
Compress: false,

View File

@@ -6,7 +6,7 @@ import (
var opts = iris.DirOptions{
IndexName: "/index.html",
// Optionally register files (map's absolute values) to be served
// Optionally register files (map's values) to be served
// when a specific path (map's key WITHOUT prefix) is requested
// is fired before client asks (HTTP/2 Push).
// E.g. "/" (which serves the `IndexName` if not empty).
@@ -14,10 +14,11 @@ var opts = iris.DirOptions{
// Note: Requires running server under TLS,
// that's why we use `iris.TLS` below.
PushTargets: map[string][]string{
"/": {
"/public/favicon.ico",
"/public/js/main.js",
"/public/css/main.css",
"/": { // Relative path without route prefix.
"favicon.ico",
"js/main.js",
"css/main.css",
// ^ Relative to the index, if need absolute ones start with a slash ('/').
},
},
Compress: true,