Skip to content

Commit b54dd48

Browse files
authored
Merge pull request #387 from devforth/forbidCacheForGetBaseConfig
fix: add cache control headers to get_base_config endpoint
2 parents 6abacc3 + 6244254 commit b54dd48

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

adminforth/modules/restApi.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ export default class AdminForthRestAPI implements IAdminForthRestAPI {
286286
server.endpoint({
287287
method: 'GET',
288288
path: '/get_base_config',
289-
handler: async ({input, adminUser, cookies, tr}): Promise<GetBaseConfigResponse>=> {
289+
handler: async ({input, adminUser, cookies, tr, response}): Promise<GetBaseConfigResponse>=> {
290290
let username = ''
291291
let userFullName = ''
292292

@@ -295,6 +295,11 @@ export default class AdminForthRestAPI implements IAdminForthRestAPI {
295295
throw new Error('No config.auth defined');
296296
}
297297

298+
response.setHeader('Cache-Control', 'no-store, no-cache, must-revalidate, proxy-revalidate');
299+
response.setHeader('Pragma', 'no-cache');
300+
response.setHeader('Expires', '0');
301+
response.setHeader('Surrogate-Control', 'no-store');
302+
298303
const dbUser = adminUser.dbUser;
299304
username = dbUser[this.adminforth.config.auth.usernameField];
300305
userFullName = dbUser[this.adminforth.config.auth.userFullNameField];

0 commit comments

Comments
 (0)