You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am facing an issue using Oathkeeper's Access Control Decision API.
It is being used as for Nginx via Authentication Based on Subrequest Result. Most of the logic works well and correctly, user is being redirected to the authentication page (based on the rule), can log in, is redirected back to the page, but then the issue starts. For example, requesting test.mydomain.com should check authentication from Ory Kratos (v1.1.0) or redirect to auth page at auth.mydomain.com and then allow accessing the site.
As Oathkeepers logs indicate, for whatever reason the /decisions request seems to be duplicated. The first request indicates, that the access to the url is granted (200, OK), but afterwards (no idea why), follows a send request with same headers, but that one is being responded with 404, Not Found, even though the URI is same. I thought I made an error in my rule definition, but why would the next request fail then, if the first did match?
The configuration files are attached below.
Config files
Oathkeeper Rules
rules.yml :
- id: "mydomain:subdomains:private"match:
url: "<http|https>://<[^.]+>.mydomain.com<(.*)?>"methods:
- GET
- POST
- PUT
- DELETE
- PATCHauthenticators:
- handler: cookie_sessionauthorizer:
handler: allowmutators:
- handler: noop
NGINX
server {
listen443 ssl http2 proxy_protocol;
listen [::]:443 ssl http2 proxy_protocol;
server_name test.mydomain.com;
include /config/nginx/ssl.conf;
client_max_body_size0;
include /config/nginx/ory-server.conf;
location/ {
include /config/nginx/ory-location.conf;
include /config/nginx/proxy.conf;
include /config/nginx/resolver.conf;
set$upstream_app test;
set$upstream_port80;
set$upstream_proto http;
proxy_pass$upstream_proto://$upstream_app:$upstream_port;
}
}
ory-server.conf:
# Location for Ory Oathkeeper authentication requestslocation= /decisions {
internal;
include /config/nginx/proxy.conf;
include /config/nginx/resolver.conf;
set$upstream_proto http;
set$upstream_app oathkeeper;
set$upstream_port4456;
proxy_pass$upstream_proto://$upstream_app:$upstream_port;
## Include the Set-Cookie header if presentauth_request_set$set_cookie$upstream_http_set_cookie;
add_header Set-Cookie $set_cookie;
proxy_pass_request_body off;
proxy_set_header Content-Length "";
}
# Virtual location for Ory Oathkeeper authentication redirectslocation@ory_proxy_signin {
internal;
## Include the Set-Cookie header if presentauth_request_set$set_cookie$upstream_http_set_cookie;
add_header Set-Cookie $set_cookie;
## Set the $target_url variable based on the original requestset_escape_uri$target_url$scheme://$http_host$request_uri;
## Translate the Location response header from the auth subrequest into a variableauth_request_set$signin_url$upstream_http_location;
if ($signin_url = '') {
## Set the $signin_url variableset$signin_url https://auth.mydomain.com/login?return_to=$target_url;
}
## Redirect to loginreturn302$signin_url;
}
ory-location.conf:
auth_request /decisions;
## If the subreqest returns 200 pass to the backend, if the subrequest returns 401 redirect to the portalerror_page401 = @ory_proxy_signin;
# ## Translate the user information response headers from the auth subrequest into variablesauth_request_set$email$upstream_http_remote_email;
auth_request_set$groups$upstream_http_remote_groups;
auth_request_set$name$upstream_http_remote_name;
auth_request_set$user$upstream_http_remote_user;
## Inject the user information into the request made to the actual upstreamproxy_set_header Remote-Email $email;
proxy_set_header Remote-Groups $groups;
proxy_set_header Remote-Name $name;
proxy_set_header Remote-User $user;
## Translate the Set-Cookie response header from the auth subrequest into a variableauth_request_set$set_cookie$upstream_http_set_cookie;
## Translate the Location response header from the auth subrequest into a variableauth_request_set$signin_url$upstream_http_location;
Reproducing the bug
Have valid and working Ory Kratos instance.
Start Oathkeeper with described configuration and rules
Set up NGINX reverse proxy to use Ory Oathkeeper for auth_request to access server.
Preflight checklist
Ory Network Project
No response
Describe the bug
I am facing an issue using Oathkeeper's Access Control Decision API.
It is being used as for Nginx via Authentication Based on Subrequest Result. Most of the logic works well and correctly, user is being redirected to the authentication page (based on the rule), can log in, is redirected back to the page, but then the issue starts. For example, requesting
test.mydomain.com
should check authentication from Ory Kratos (v1.1.0) or redirect to auth page atauth.mydomain.com
and then allow accessing the site.As Oathkeepers logs indicate, for whatever reason the
/decisions
request seems to be duplicated. The first request indicates, that the access to the url is granted (200, OK), but afterwards (no idea why), follows a send request with same headers, but that one is being responded with 404, Not Found, even though the URI is same. I thought I made an error in my rule definition, but why would the next request fail then, if the first did match?The configuration files are attached below.
Config files
Oathkeeper Rules
rules.yml
:NGINX
ory-server.conf
:ory-location.conf
:Reproducing the bug
auth_request
to access server.Relevant log output
Relevant configuration
Version
v0.40.7
On which operating system are you observing this issue?
Linux
In which environment are you deploying?
Docker Compose
Additional Context
No response
The text was updated successfully, but these errors were encountered: