Skip to content

Keycloak: header too large #59049

Closed
Closed

Description

@ecodina

Apache Airflow version

3.1.3

If "Other Airflow 2/3 version" selected, which one?

No response

What happened?

I am deploying Airflow 3 using the Keycloak auth manager. Locally (using the same settings as prod), everything works well, but in prod our NGINX blocks the request to /auth/login_callback:

nginx-private-rp02-ha01  | 2025/12/04 13:33:12 [error] 

200#200: *121 upstream sent too big header while reading response header from upstream,

client: 192.168.253.38, 
server: stag-airflow.company.com, 
request: "GET /auth/login_callback?state=&session_state=8de1b5ff-e518-499d-a4c4-c615d1182320&iss=https%3A%2F%2Fstag-sso.company.com%2Frealms%2Fmyrealm&code=b26c50b8-76e3-406a-a8b3-55c1e2a86ae9.8de1b5ff-e518-499d-a4c4-c615d1182320.1da428d2-d35d-4378-b199-782b9afdeabb HTTP/2.0", 
upstream: "http://172.23.1.164:80/auth/login_callback?state=&session_state=8de1b5ff-e518-499d-a4c4-c615d1182320&iss=https%3A%2F%2Fstag-sso.company.com%2Frealms%2Fmyrealm&code=b26c50b8-76e3-406a-a8b3-55c1e2a86ae9.8de1b5ff-e518-499d-a4c4-c615d1182320.1da428d2-d35d-4378-b199-782b9afdeabb%22, 
host: "stag-airflow.company.com"

The upstream IP corresponds to Traefik, more details on our network map below.

None of the requests I can see on the browser have a huge header.

We have added the following configuration line in NGINX:

large_client_header_buffers 4 32k;

With this, we have been able to access the page (although it is strange to need headers > 8k, the default in NGINX).

What you think should happen instead?

No response

How to reproduce

We use Keycloak v26.2.5. This is the same instance I also tested from my PC and worked well.
Our airflow.cfg for the KC auth manager contains the 4 parameters (client_id,client_secret,realm,server_url)
Start the api-server and try to login with KC served all with nginx

Operating System

Using docker image slim-3.1.3-python3.12

Versions of Apache Airflow Providers

apache-airflow-providers-keycloak==0.3.0

Deployment

Docker-Compose

Deployment details

Deployed in a Docker Swarm cluster managed with Portainer. Network managed with Traefik and NGINX.

Our network map is as follows:

SSL terminating NGINX --> Traefik --> api-server in docker container

NGINX is configured with the options in the howto.

Traefik is configured with the following labels:

labels:
  traefik.enable: "true"
  traefik.swarm.network: "traefik-net"
  traefik.http.services.airflow.loadbalancer.server.port: "8080"
  traefik.http.routers.airflow.rule: Host(`${TRAEFIK_HOSTNAME}`)
  traefik.http.routers.airflow.entrypoints: "web"
  traefik.http.routers.airflow.priority: 80
  traefik.http.routers.airflow.service: airflow
  traefik.http.middlewares.airflow-csp.headers.contentsecuritypolicy: frame-ancestors 'self';
  traefik.http.routers.airflow.middlewares: airflow-csp

Anything else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Activity

  1. added
    kind:bug
    needs-triage
    on Dec 4, 2025
  2. ecodina commented on Dec 4, 2025

    @ecodina
    Author
  3. ecodina commented on Dec 5, 2025

    @ecodina
    Author
  4. removed
    needs-triage
    on Dec 16, 2025
  5. vincbeck commented on Jan 15, 2026

    @vincbeck
    Contributor

    Not sure we can do anything about it. It seems you solved it by updating NGINX config. On the implementation side, we have no control over headers sent by Keycloak. Closing this issue, if you think this issue is still valid, please re-open it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:autharea:corekind:bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions