From 45d1db88804a77fc489e91fed4e4c17ed94b0467 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Tue, 30 Nov 2021 11:12:34 +0100 Subject: [PATCH] website/docs: add proxy custom header docs Signed-off-by: Jens Langhammer --- .../docs/providers/proxy/custom_headers.md | 41 +++++++++++++++++++ website/docusaurus.config.js | 4 +- website/sidebars.js | 1 + 3 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 website/docs/providers/proxy/custom_headers.md diff --git a/website/docs/providers/proxy/custom_headers.md b/website/docs/providers/proxy/custom_headers.md new file mode 100644 index 000000000..4fa39d39f --- /dev/null +++ b/website/docs/providers/proxy/custom_headers.md @@ -0,0 +1,41 @@ +--- +title: Custom headers +--- + +The proxy can send custom headers to your upstream application. These can be configured in one of two ways: + +- Group attributes; this allows for inheritance, but only allows static values +- Property mappings; this allows for dynamic values + +## Group attributes + +Edit the group or user you wish the header to be set for, and set these attributes: + +```yaml +additionalHeaders: + X-My-Header: value +``` + +You can the add users to this group or override the field in users. + +## Property Mappings + +For dynamic Header values (for example, your application requires X-App-User to contain the username), property mappings can be used. + +Create a new Scope mapping with a name and scope of your choice, and use an expression like this: + +```python +return { + "ak_proxy": { + "user_attributes": { + "additionalHeaders": { + "X-App-User": request.user.username + } + } + } +} +``` + +After you've created this Scope mapping, make sure to edit the proxy provider and select the mapping. + +As you can see by the similar structure, this just overrides any static attributes, so both of these methods can be combined. diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js index 95d4a68df..549d07748 100644 --- a/website/docusaurus.config.js +++ b/website/docusaurus.config.js @@ -18,7 +18,7 @@ module.exports = { { to: "docs/", activeBasePath: "docs", - label: "Docs", + label: "Documentation", position: "left", }, { @@ -30,7 +30,7 @@ module.exports = { { to: "developer-docs/", activeBasePath: "developer-docs", - label: "Developer Docs", + label: "Developer", position: "left", }, { diff --git a/website/sidebars.js b/website/sidebars.js index 7099cd2b2..63ed85311 100644 --- a/website/sidebars.js +++ b/website/sidebars.js @@ -37,6 +37,7 @@ module.exports = { label: "Proxy Provider", items: [ "providers/proxy/proxy", + "providers/proxy/custom_headers", "providers/proxy/forward_auth", ], },