strip_path
strips the prefix from the final upstream request, not the initial request
#1085
Open
5 of 6 tasks
Labels
bug
Something is not working.
Preflight checklist
Describe the bug
We have 1 backend serving 2 applications we wish to protect via different Oathkeeper rules.
Our rules look like:
The idea being a typical request for
https://app1.api.company.com/foo
would go tohttp://backend/api/app1/foo
(which works fine without thestrip_path: '/api/app1
).However, if the backend generates an absolute url in its response it would be
https://app1.api.company.com/api/app1/foo
.This means some reqeusts would repeat the
/api/app1
prefix ending up with a backend request tohttp://backend/api/app1/api/app1/foo
(which is what happens without thestrip_path: '/api/app1
).I had expected the
strip_path
would save me here allowing/api/app1
to be stripped before forwarding the request to the backend. It appears it does, but it breaks normal usage without the extra prefix.A request of
https://app1.api.company.com/api/app1/foo
does get to the backend athttp://backend/api/app1/foo
, however requests tohttps://api1.api.company/foo
(without the extra prefix) incorrectly have the upstream prefix stripped.It appears the strip_path is applying to the final request URL and not the original request.
I am not sure what is intended, the docs say:
Which I read as the incoming request having the replacement, not the final request to the backend.
Reproducing the bug
https://app1.api.company.com/api/app1/foo
, this correctly hitshttp://backend/api/app1/foo
https://app1.api.company.com/api/app1/foo
, this incorrectly hitshttp://backend/foo
Relevant log output
Relevant configuration
Version
helm 0.29 deploying oathkeeper 0.41.0
On which operating system are you observing this issue?
Linux
In which environment are you deploying?
Kubernetes with Helm
Additional Context
No response
The text was updated successfully, but these errors were encountered: