title: Configuring nginx plus to work with ssrs (and ntlm) as a reverse proxy
body: <p>I'm attempting to use an nginx plus server as a reverse proxy for an ssrs instance running on a separate machine. Nginx is hosted on a linux (Ubuntu) server; ssrs is (of course) on a Windows server. Accessing ssrs directly (without going through the reverse proxy) works fine.</p>
  
  <p>My question is how to properly configure Nginx Plus for this situation. Here is the relevant part of my nginx configuration file:</p>
  
  <pre><code>upstream reports_backend {
      server a.b.c.d:443;
      ntlm;
  }
  
  server {
      ...
      location /Reports {
          rewrite ^/Reports/(.*)? /Reports/$1 break;
          proxy_http_version 1.1;
          proxy_set_header Connection "";
          proxy_set_header Host a.b.c.d;
          proxy_pass https://reports_backend/Reports;
      }
  
      ...
  }
  </code></pre>
  
  <p>This does connect to ssrs on server a.b.c.d (not its real name) successfully and I can navigate the report folders in the ssrs web portal just fine. The problem comes when clicking on a report. The URI changes from "Reports" to "ReportServer" which gives me a 404 (not found) from Nginx.</p>
  
  <p>I've tried putting in another location defined similarly to the above:</p>
  
  <pre><code>location /ReportServer {
      rewrite ^/ReportServer/(.*)? /ReportServer/$1 break;
      proxy_http_version 1.1;
      proxy_set_header Connection "";
      proxy_set_header Host a.b.c.d;
      proxy_pass https://reports_backend/ReportServer;
  }
  </code></pre>
  
  <p>The problem with this approach is that it makes a new connection when following the /ReportServer proxy pass, which doesn't contain the NTLM authentication information from the /Reports connection.</p>
  
  <p>I've tried putting the /Reports and /ReportServer endpoints together in one location, and that didn't help (I couldn't get the rewrites to work properly).</p>
  
  <p>Any ideas?</p>