Skip to content

Commit 667cfa5

Browse files
committed
v0.0.4-2 - Fix fault_tolerant when opa is down or policy is missing, X-Kong-Authz-Skipped also on request
1 parent 737bbe4 commit 667cfa5

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,15 @@ Custom Kong plugin to allow for fine grained Authorization through [Open Policy
1010

1111
Plugin will continue the request to the upstream target if OPA responds with `true`, else the plugin will return a `403 Forbidden`.
1212

13-
Plugin will add the response headers:
13+
Plugin will add the:
1414

15-
- `X-Kong-Authz-Latency`: Latency generated by the plugin
16-
- `X-Kong-Authz-Cache`: "Miss" or "Hit" when cache is enabled
17-
- `X-Kong-Authz-Skip`: "true" when `fault_tolerant` is enabled and Kong had troubles
15+
- request headers:
16+
- `X-Kong-Authz-Skipped`: "true" when `fault_tolerant` is enabled and Kong had troubles
17+
18+
- response headers:
19+
- `X-Kong-Authz-Latency`: Latency generated by the plugin
20+
- `X-Kong-Authz-Cache`: "Miss" or "Hit" when cache is enabled
21+
- `X-Kong-Authz-Skipped`: "true" when `fault_tolerant` is enabled and Kong had troubles
1822

1923
Plugin priority: `799`
2024

opa/access.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,8 @@ function _M.execute(conf)
185185
if (not body) or (err) then
186186
if conf.fault_tolerant then
187187
kong.response.set_header("X-Kong-Authz-Latency", (ngx.now() - start_time))
188-
kong.response.set_header("X-Kong-Authz-Skip", "true")
188+
kong.response.set_header("X-Kong-Authz-Skipped", "true")
189+
kong.service.request.set_header("X-Kong-Authz-Skipped", "true")
189190
return true
190191
else
191192
return kong.response.exit(500, { message = "An unexpected error occurred", error = err })

0 commit comments

Comments
 (0)