cuddly-city-78540
11/12/2025, 3:09 PMalert-room-61990
11/12/2025, 5:57 PMlocation /api/cs/ {
auth_request /decisions;
auth_request_set $next_uri $upstream_http_X_Original_URI;
# Capture Authorization header returned by Oathkeeper
auth_request_set $auth_header $upstream_http_authorization;
# Forward the Authorization Bearer token received from
# Oathkeeper to our backend service.
# Remove the initial cookies.
proxy_set_header Authorization $auth_header;
proxy_set_header Cookie "";
set $upstream_cs_api <http://cs-api:8080>;
rewrite ^/api/cs/(.*)$ /$1 break;
proxy_pass $upstream_cs_api;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
}
location = /decisions {
internal;
set $upstream_oathkeeper <http://cs-oathkeeper:4456>;
proxy_pass $upstream_oathkeeper/decisions;
proxy_pass_request_body off;
proxy_set_header Content-Length "";
proxy_set_header Host $http_host;
proxy_set_header X-Original-URI $request_uri;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-Method $request_method;
proxy_set_header X-Forwarded-Uri $request_uri;
proxy_set_header Cookie $http_cookie;
}
Oathkeeper:
serve:
proxy:
port: 4455 # run the proxy at port 4455
api:
port: 4456 # run the api at port 4456
access_rules:
matching_strategy: regexp
repositories:
- file:///etc/config/oathkeeper/rules.json
errors:
fallback:
- json
handlers:
json:
enabled: true
config:
verbose: true
authenticators:
cookie_session:
enabled: true
config:
check_session_url: <http://cs-kratos:4433/sessions/whoami>
preserve_path: true
extra_from: "@this"
subject_from: "identity.id"
only:
- ory_kratos_session
authorizers:
allow:
enabled: true
mutators:
id_token:
enabled: true
config:
issuer_url: <http://cs-oathkeeper:4456/>
jwks_url: file:///etc/config/oathkeeper/secrets/id_token.jwks.json
claims: |
{
"session": {{ .Extra | toJson }}
}
Rules:
[
{
"id": "api-cs-rule",
"upstream": {
"url": "<http://cs-api:8080>"
},
"match": {
"url": "<^https?://localhost(:7443)?/api/cs/.*$>",
"methods": ["GET", "POST", "PATCH", "PUT", "DELETE"]
},
"authenticators": [{ "handler": "cookie_session" }],
"authorizer": { "handler": "allow" },
"mutators": [{ "handler": "id_token" }]
}
]cuddly-city-78540
11/12/2025, 6:02 PMcuddly-city-78540
11/12/2025, 6:03 PM<.*> rule as a catch all and it responded fine, so I am stumped as to why the same rule matched in the code is not working properly in one case. Going to keep looking.