File tree Expand file tree Collapse file tree 2 files changed +8
-8
lines changed
Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -19,9 +19,6 @@ import { ADMIN_ORIGIN, ADMIN_ORIGIN_NEW } from './utils/admin.js';
1919const { host : adminHost } = new URL ( ADMIN_ORIGIN ) ;
2020const { host : newAdminHost } = new URL ( ADMIN_ORIGIN_NEW ) ;
2121
22- /** Cache-Control max-age in seconds for added project hosts (HTML, JSON and code): 1 minute. */
23- export const CACHE_MAX_AGE_SECONDS = 60 ;
24-
2522function getRandomId ( ) {
2623 return Math . floor ( Math . random ( ) * 1000000 ) ;
2724}
@@ -59,10 +56,14 @@ export function getCacheControlRules(projectConfigs) {
5956 priority : 1 ,
6057 action : {
6158 type : 'modifyHeaders' ,
62- responseHeaders : [ {
59+ requestHeaders : [ {
60+ operation : 'set' ,
6361 header : 'Cache-Control' ,
62+ value : 'no-cache' ,
63+ } , {
6464 operation : 'set' ,
65- value : `max-age=${ CACHE_MAX_AGE_SECONDS } , must-revalidate` ,
65+ header : 'Pragma' ,
66+ value : 'no-cache' ,
6667 } ] ,
6768 } ,
6869 condition : {
Original file line number Diff line number Diff line change @@ -18,7 +18,6 @@ import { setUserAgent } from '@web/test-runner-commands';
1818import sinon from 'sinon' ;
1919
2020import {
21- CACHE_MAX_AGE_SECONDS ,
2221 configureAuthAndCorsHeaders ,
2322 getCacheControlRules ,
2423 getHostDomain ,
@@ -82,8 +81,8 @@ describe('Test auth', () => {
8281 ] ;
8382 const rules = getCacheControlRules ( configs ) ;
8483 expect ( rules ) . to . have . lengthOf ( 2 ) ;
85- expect ( rules . every ( ( r ) => r . action ?. responseHeaders ?. [ 0 ] ? .header === 'Cache-Control' ) ) . to . be . true ;
86- expect ( rules . every ( ( r ) => r . action . responseHeaders [ 0 ] . value === `max-age= ${ CACHE_MAX_AGE_SECONDS } , must-revalidate` ) ) . to . be . true ;
84+ expect ( rules . every ( ( r ) => r . action ?. requestHeaders ?. some ( ( h ) => h . header === 'Cache-Control' && h . value === 'no-cache' ) ) ) . to . be . true ;
85+ expect ( rules . every ( ( r ) => r . action ?. requestHeaders ?. some ( ( h ) => h . header === 'Pragma' && h . value === 'no-cache' ) ) ) . to . be . true ;
8786 const filters = rules . map ( ( r ) => r . condition . regexFilter ) ;
8887 expect ( filters ) . to . include ( '^https://prod\\.example\\.com/.*' ) ;
8988 expect ( filters ) . to . include ( '^https://live\\.example\\.com/.*' ) ;
You can’t perform that action at this time.
0 commit comments