Welcome! Log In Create A New Profile

Advanced

Access original request whn in njs aut_request

Posted by dcore94 
Access original request whn in njs aut_request
April 20, 2021 12:15PM
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))
}
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 75
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready