Edit: It seems that the problem was in the header ...
# general
s
Edit: It seems that the problem was in the header mutator - when I put this data as a part of the ID token mutator I got it immediately How does one access the regex groups in URLs? I've tried almost everything but I have no idea how Go templates work. Here's my rule and config:
Copy code
{
  "id": "protected-resources",
  "description": "Strictly protects all known API resources. Requires valid Cookie.",
  "upstream": {
    "url": "<http://backend:8393/>"
  },
  "match": {
    "url": "<https://api.example.org/><(users|schools|teachers|students|classes|subjects|daily-schedules|lessons|buildings|floors|rooms|roles)(/.*)?>",
    "methods": [
      "GET",
      "POST",
      "PUT",
      "PATCH",
      "DELETE",
      "OPTIONS"
    ]
  },
  "authenticators": [
    {
      "handler": "oauth2_introspection"
    }
  ],
  "authorizer": {
    "handler": "allow"
  },
  "mutators": [
    {
      "handler": "header"
    },
    {
      "handler": "id_token"
    }
  ]
}
Copy code
mutators:
 header:
  enabled: true
  config:
   headers:
    X-Resource-Name: '{{ .MatchContext.RegexpCaptureGroups | join ", " }}'
Everything I try results in this error:
Copy code
'error executing headers template "{{ .MatchContext.RegexpCaptureGroups | join ", " }}" in rule "protected-resources": template: protected-resources:X-Resource-Name:1:3: executing "protected-resources:X-Resource-Name" at <print>: wrong number of args for print: want 1 got 2'
m
Thanks for sharing your fix 🙌
👍 1