From 9cf5d951aaab5d55427aa0e72b316eaaa48bfe26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=A9tan=20Collaud?= Date: Sun, 16 Jan 2022 22:37:28 +0100 Subject: [PATCH] jwt accomodation (#8126) --- docs/examples/customization/jwt/README.md | 48 +++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 docs/examples/customization/jwt/README.md diff --git a/docs/examples/customization/jwt/README.md b/docs/examples/customization/jwt/README.md new file mode 100644 index 000000000..a751ccb7b --- /dev/null +++ b/docs/examples/customization/jwt/README.md @@ -0,0 +1,48 @@ +# Accommodation for JWT + +JWT (short for Json Web Token) is an authentication method widely used. Basically an authentication server generates +a JWT and you then use this token in every request you make to a backend service. The JWT can be quite big and is +present in every http headers. This means you may have to adapt the max-header size of your nginx-ingress in order +to support it. + +## Symptoms + +If you use JWT and you get http 502 error from your ingress, it may be a sign that the buffer size is not big enough. + +To be 100% sure look at the logs of the `ingress-nginx-controller` pod, you should see something like this: + +``` +upstream sent too big header while reading response header from upstream... +``` + + +## Increase buffer size for headers + +In nginx, we want to modify the property `proxy-buffer-size`. The size is arbitrary. It depends on your needs. Be aware +that a high value can lower the performance of your ingress proxy. In general a value of 16k should get you covered. + +### Using helm +If you're using helm you can simply use the [`config` properties](https://github.com/kubernetes/ingress-nginx/blob/main/charts/ingress-nginx/values.yaml#L37). +```yaml + # -- Will add custom configuration options to Nginx https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/configmap/ + config: + proxy-buffer-size: 16k +``` + +## Manually in kubernetes config files + +If you use an already generated config from for a provider, you will have to change the `controller-configmap.yaml` + +```yaml +--- +# Source: ingress-nginx/templates/controller-configmap.yaml +apiVersion: v1 +kind: ConfigMap +# ... +data: + #... + proxy-buffer-size: "16k" +``` + +References: + * [Custom Configuration](../custom-configuration/) \ No newline at end of file