I have done this by patching auth_request module to pass 441 and 443 custom http status codes throu, and then I defined "error_page 441 =401 /unauth.html" in nginx config. I make subrequest url to return "Status: 441" instead of 401, nginx error_page directive turns it to 401.
↧