Skip to content

Commit

Permalink
Fixed header map file cache issue (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
rorylshanks authored Mar 22, 2024
1 parent f62adae commit b106778
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/authz.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ async function addRequestedHeaders(req, res, route, user, discoveredGroups) {
async function getRequestHeaderMapConfig(user, route) {
var userId = user.id
var userGroups = user.groups
var requestHeaderMap = requestHeaderMapCache.get(`${userId}-${route}`)
var requestHeaderMap = requestHeaderMapCache.get(`${userId}-${JSON.stringify(route)}`)
if (requestHeaderMap) {
log.trace("Returning requestHeaderMap from cache")
return requestHeaderMap
Expand Down Expand Up @@ -111,7 +111,7 @@ async function getRequestHeaderMapConfig(user, route) {
...requestHeaderMap[userId],
}
}
requestHeaderMapCache.put(`${userId}-${route}`, result)
requestHeaderMapCache.put(`${userId}-${JSON.stringify(route)}`, result)
return result
} catch (error) {
log.error({ message: "Unable to get config for requestHeaderMap", context: { error: error.message, stack: error.stack, route: route } })
Expand Down

0 comments on commit b106778

Please sign in to comment.