Hello.
I am trying to access the original request, method and host header from inside an njs module I developed in order to make a PEP in combination with auth_request.
But however I try, I always get the internal request (/pep) and method (always GET). I'm also unable to pass information with extra-headers as in the pep2 location example ...
I also tried with r.parent but it is undefined...
How should I do this? I want to gather claims inside my script to use for authorizations.
Thank you.
The conf ...
location / {
auth_request /pep;
proxy_pass http://_internal-server;
}
location = /pep {
js_content authz.enforce;
}
location = /pep2 {
proxy_pass_request_body off;
proxy_set_header Content-Length "";
proxy_set_header X-Original-URI $request_uri;
js_content authz.enforce;
}
The js code ....
export default { enforce };
function enforce(r) {
r.error("Inside NJS enforce " + njs.dump(r))
}