auth_request /validate; location = /validate { internal; if ($request_method = 'OPTIONS') { return 200; } proxy_pass http://172.17.0.1:9024/validate; proxy_set_header Host $http_host; proxy_pass_request_body off; proxy_set_header Content-Length ""; # these return values are used by the @error401 call auth_request_set $auth_resp_jwt $upstream_http_x_vouch_jwt; auth_request_set $auth_resp_err $upstream_http_x_vouch_err; auth_request_set $auth_resp_failcount $upstream_http_x_vouch_failcount; } error_page 401 = @error401; location @error401 { return 302 https://sso.faked.org/login?url=$scheme://$http_host$request_uri&vouch-failcount=$auth_resp_failcount&X-Vouch-Token=$auth_resp_jwt&error=$auth_resp_err; }