AkkiD
AkkiD

Reputation: 119

Combination of using nginx as a reverse proxy with keycloak as upstream server fails

We are nginx newbies and trying to replace httpd with it. We have the following nginx configuration:

location /auth {
      proxy_pass http://keycloak_server$request_uri;

      proxy_http_version 1.1;

      proxy_set_header Host               $host;
      proxy_set_header X-Real-IP          $remote_addr;
      proxy_set_header X-Forwarded-For    $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto  https;
}

This works in providing access to the administrator portal. However we use also keycloak for authentication for our applications, and the problem is that keycloak responds with a 302 redirect however nginx treats it as a 502 bad gateway error.

The apache httpd works without any problems. What are we doing wrong ? Any pointers or specific configuration guidance would be appreciated.

Upvotes: 2

Views: 3134

Answers (1)

AkkiD
AkkiD

Reputation: 119

The issue was resolved. It was because the upstream was sending too big a header. Modifying the buffer size for proxy worked.

Upvotes: 9

Related Questions