From 0d92112a3fec581494d9e25fee87a29d30a237b4 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Wed, 9 Feb 2022 10:41:42 +0100 Subject: [PATCH] website/docs: add backend_override docs Signed-off-by: Jens Langhammer --- website/docs/providers/proxy/proxy.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/website/docs/providers/proxy/proxy.md b/website/docs/providers/proxy/proxy.md index d5ad5063f..185e7fdf2 100644 --- a/website/docs/providers/proxy/proxy.md +++ b/website/docs/providers/proxy/proxy.md @@ -79,3 +79,17 @@ In this mode, the regular expressions are matched against the Request's Path. ### Forward auth (domain level) In this mode, the regular expressions are matched against the Request's full URL. + +## Dynamic backend selection + +You can configure the backend the proxy should access dynamically via *Scope mappings*. To do so, create a new *Scope mapping*, with a name and scope of your choice. As expression, use this: + +```python +return { + "ak_proxy": { + "backend_override": f"http://foo.bar.baz/{request.user.username}" + } +} +``` + +Afterwards, edit the *Proxy provider* and add this new mapping. The expression is only evaluated when the user logs into the application.