feat: Disable HTML caching

This commit is contained in:
chenyh 2022-06-12 19:46:55 +08:00
parent ec95dd532a
commit 5b34bb0af9
12 changed files with 27 additions and 29 deletions

View File

@ -41,9 +41,9 @@ export default (domains, global) => {
};
if (global.logging.accessLog.computed) config['location = /robots.txt'].access_log = 'off';
if (global.performance.changesTakeEffect.computed) {
// Take effect in time for html
config['# Take effect in time for html'] = '';
if (global.performance.disableHtmlCaching.computed) {
// Disable HTML caching for changes take effect in time
config['# Disable HTML caching'] = '';
const loc = `location ~* \\.(?:${extensions.html})$`;
config[loc] = {
add_header: 'Cache-Control "no-cache"',
@ -135,7 +135,6 @@ export default (domains, global) => {
config.brotli_types = gzipTypes;
}
// Done!
return config;
};

View File

@ -27,8 +27,8 @@ THE SOFTWARE.
import common from '../../common';
export default {
changesTakeEffect: 'Changes take effect in time',
enableChangesTakeEffect: `${common.enable} changes take effect in time`,
disableHtmlCaching: 'Disable HTML caching',
enableChangesTakeEffect: `disable HTML caching`,
gzipCompression: 'Gzip Komprimierung',
enableGzipCompression: `${common.enable} Gzip Komprimierung`,
brotliCompression: 'Brotli Komprimierung',

View File

@ -27,8 +27,8 @@ THE SOFTWARE.
import common from '../../common';
export default {
changesTakeEffect: 'Changes take effect in time',
enableChangesTakeEffect: `${common.enable} changes take effect in time`,
disableHtmlCaching: 'Disable HTML caching',
enableChangesTakeEffect: `disable HTML caching`,
gzipCompression: 'Gzip compression',
enableGzipCompression: `${common.enable} gzip compression`,
brotliCompression: 'Brotli compression',

View File

@ -27,8 +27,8 @@ THE SOFTWARE.
import common from '../../common';
export default {
changesTakeEffect: 'Changes take effect in time',
enableChangesTakeEffect: `${common.enable} changes take effect in time`,
disableHtmlCaching: 'Disable HTML caching',
enableChangesTakeEffect: `disable HTML caching`,
gzipCompression: 'Compresión Gzip',
enableGzipCompression: `${common.enable} compresión gzip`,
brotliCompression: 'Compresión Brotli',

View File

@ -27,8 +27,8 @@ THE SOFTWARE.
import common from '../../common';
export default {
changesTakeEffect: 'Changes take effect in time',
enableChangesTakeEffect: `${common.enable} changes take effect in time`,
disableHtmlCaching: 'Disable HTML caching',
enableChangesTakeEffect: `disable HTML caching`,
gzipCompression: 'Compression Gzip',
enableGzipCompression: `${common.enable} la compression gzip`,
brotliCompression: 'Compression Brotli',

View File

@ -27,8 +27,8 @@ THE SOFTWARE.
import common from '../../common';
export default {
changesTakeEffect: 'Changes take effect in time',
enableChangesTakeEffect: `${common.enable} changes take effect in time`,
disableHtmlCaching: 'Disable HTML caching',
enableChangesTakeEffect: `disable HTML caching`,
gzipCompression: 'Kompresja gzip',
enableGzipCompression: `${common.enable} kompresję gzip`,
brotliCompression: 'Kompresja brotli',

View File

@ -27,8 +27,8 @@ THE SOFTWARE.
import common from '../../common';
export default {
changesTakeEffect: 'Changes take effect in time',
enableChangesTakeEffect: `${common.enable} changes take effect in time`,
disableHtmlCaching: 'Disable HTML caching',
enableChangesTakeEffect: `disable HTML caching`,
gzipCompression: 'Compressão Gzip',
enableGzipCompression: `${common.enable} compressão gzip`,
brotliCompression: 'Compressão Brotli',

View File

@ -27,8 +27,8 @@ THE SOFTWARE.
import common from '../../common';
export default {
changesTakeEffect: 'Changes take effect in time',
enableChangesTakeEffect: `${common.enable} changes take effect in time`,
disableHtmlCaching: 'Disable HTML caching',
enableChangesTakeEffect: `disable HTML caching`,
gzipCompression: 'Gzip сжатие',
enableGzipCompression: `${common.enable} gzip сжатие`,
brotliCompression: 'Brotli сжатие',

View File

@ -27,15 +27,15 @@ THE SOFTWARE.
import common from '../../common';
export default {
disableHtmlCaching: '禁用 HTML 缓存',
gzipCompression: 'Gzip 压缩',
enableGzipCompression: `${common.enable}Gzip压缩`,
enableGzipCompression: `${common.enable} Gzip 压缩`,
brotliCompression: 'Brotli 压缩',
enableBrotliCompression: `${common.enable} Brotli 压缩`,
brotliIsANonStandardModule: 'Brotli 并不是一个 standard NGINX 模块, 请查看 ',
brotliGoogleNgxBrotliProject: 'Google ngx_brotli 项目',
brotliForBuildingNginxWithBrotli: ' 以构建支持 Brotli 的 NGINX!',
changesTakeEffect: '变更及时生效',
enableChangesTakeEffect: `${common.enable}变更及时生效`,
enableChangesTakeEffect: `禁用 HTML 缓存`,
expirationForAssets: '资源有效期',
expirationForMedia: '媒体资源有效期',
expirationForSvgs: 'SVGs有效期',

View File

@ -27,8 +27,8 @@ THE SOFTWARE.
import common from '../../common';
export default {
changesTakeEffect: 'Changes take effect in time',
enableChangesTakeEffect: `${common.enable} changes take effect in time`,
disableHtmlCaching: 'Disable HTML caching',
enableChangesTakeEffect: `disable HTML caching`,
gzipCompression: 'Gzip 壓縮',
enableGzipCompression: `${common.enable}Gzip壓縮`,
brotliCompression: 'Brotli 壓縮',

View File

@ -30,13 +30,13 @@ THE SOFTWARE.
<div class="field is-horizontal">
<div class="field-label">
<label class="label">{{ $t('templates.globalSections.performance.changesTakeEffect') }}</label>
<label class="label">{{ $t('templates.globalSections.performance.disableHtmlCaching') }}</label>
</div>
<div class="field-body">
<div class="field">
<div :class="`control${changesTakeEffectChanged ? ' is-changed' : ''}`">
<div :class="`control${disableHtmlCachingChanged ? ' is-changed' : ''}`">
<div class="checkbox">
<PrettyCheck v-model="changesTakeEffect" class="p-default p-curve p-fill p-icon">
<PrettyCheck v-model="disableHtmlCaching" class="p-default p-curve p-fill p-icon">
{{ $t('templates.globalSections.performance.enableChangesTakeEffect') }}
</PrettyCheck>
</div>
@ -158,7 +158,7 @@ THE SOFTWARE.
import PrettyCheck from '../inputs/checkbox';
const defaults = {
changesTakeEffect: {
disableHtmlCaching: {
default: true,
enabled: true,
},
@ -186,7 +186,6 @@ THE SOFTWARE.
default: '7d',
enabled: true,
},
};
export default {

View File

@ -45,7 +45,7 @@ const globalMap = {
python_server: ['python', 'pythonServer'],
changesTakeEffect: ['performance', 'changesTakeEffect', oldBool],
disableHtmlCaching: ['performance', 'disableHtmlCaching', oldBool],
gzip: ['performance', 'gzipCompression', oldBool],
brotli: ['performance', 'brotliCompression', oldBool],
expires_assets: ['performance', 'assetsExpiration'],