4 ms·
Just watch out when using oauth2-proxy because its default session storage using cookies can easily blow out the header size of nginx leading to the dreaded 400
by mdaniel 2y ago
Just watch out when using oauth2-proxy because its default session storage using cookies can easily blow out the header size of nginx leading to the dreaded 400 header too large
One fix is moving session storage to redis <https://oauth2-proxy.github.io/oauth2-proxy/configuration/session_storage https://oauth2-proxy.github.io/oauth2-proxy/configuration/se...> and the other (if you have control over the nginx config) is bumping its allowed header size "large_client_header_buffers 4 128k;" <https://nginx.org/en/docs/http/ngx_http_core_module.html#large_client_header_buffers https://nginx.org/en/docs/http/ngx_http_core_module.html#lar...>
If you're using nginx as an ingress controller, the annotations support it: <https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/#configuration-snippet https://kubernetes.github.io/ingress-nginx/user-guide/nginx-...> and/or auth-snippet <https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/#external-authentication https://kubernetes.github.io/ingress-nginx/user-guide/nginx-...>
- justin_oaks 2y agoThanks for the heads-up. I'm curious at what would be stored in the session to make it large enough to be a problem, but it's good to know to watch out for it.
- mdaniel 2y agoI believe it's almost always the "groups" claim <https://github.com/oauth2-proxy/oauth2-proxy/issues?q=cookie+size https://github.com/oauth2-proxy/oauth2-proxy/issues?q=cookie...> but I would suspect any sufficiently large set of claims would do it (e.g. a huge "iss", erroneously returning the user profile jpeg attribute, who knows)