title: Combination of using nginx as a reverse proxy with keycloak as upstream server fails
body: <p>We are nginx newbies and trying to replace httpd with it.
  We have the following nginx configuration:</p>
  
  <pre><code>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;
  }
  </code></pre>
  
  <p>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.</p>
  
  <p>The apache httpd works without any problems.
  What are we doing wrong ? Any pointers or specific configuration guidance would be appreciated.</p>