title: SignalR .NET Core 2.1 not working on proxied docker container
body: <p>I have a .NET Core 2.1 Web API (using <code>2.1.0-preview1-final</code>) working fine locally using SignalR <code>1.0.0-preview1-final</code>. I'm using for the front-end an Angular app which has the package <code>"@aspnet/signalr": "1.0.0-preview1-final"</code> so everything matches and I have both HTTP endpoints and Hubs working as expected when I run the programs locally.</p>
  
  <p>When I deploy to my virtual server I have an Nginx reverse proxy that sends request to all the applications behind it. I'm using Docker and I haven't had any problems with it in other projects when we deploy the v1.0 of an entire ecosystem.</p>
  
  <p>The differences I have in this particular scenario are two:</p>
  
  <ol>
  <li>I have IdentityServer4 using AspNetIdentity and had to remove the <code>proxy_buffering off</code> option from the Nginx configuration to get it to work (following <a href="https://andrewlock.net/fixing-nginx-upstream-sent-too-big-header-error-when-running-an-ingress-controller-in-kubernetes/" rel="nofollow noreferrer">https://andrewlock.net/fixing-nginx-upstream-sent-too-big-header-error-when-running-an-ingress-controller-in-kubernetes/</a>)</li>
  <li>I was reading that you shouldn't do 1) when using SignalR because you may have problems with it - not sure if this is the case now.</li>
  </ol>
  
  <p>I'm capturing the logs of the API and I can see that when I try to connect to the Hubs I get back:</p>
  
  <pre><code>info: Microsoft.AspNetCore.Cors.Infrastructure.CorsService[4]
        Policy execution successful.
  info: Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler[2]
        Successfully validated the token.
  info: Microsoft.AspNetCore.Authorization.DefaultAuthorizationService[1]
        Authorization was successful.
  info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
        Request finished in 7.4652ms 200 application/json
  </code></pre>
  
  <p>So I'm assuming this is correct. Now on the client side (Angular app): I see this:</p>
  
  <blockquote>
    <p>Error: Failed to start the connection. Error: No available transports found.</p>
  </blockquote>
  
  <p>but if I inspect the response:</p>
  
  <pre><code>{"connectionId":"nHzKKYtp0ITwlEntjqLprA","availableTransports":[{"transport":"WebSockets","transferFormats":["Text","Binary"]},{"transport":"ServerSentEvents","transferFormats":["Text"]},{"transport":"LongPolling","transferFormats":["Text","Binary"]}]}
  </code></pre>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Compared the response when running locally I got:</p>
  
  <pre><code>{"connectionId":"4ea7b1ea-8754-472b-baef-527073872d2a","availableTransports":["WebSockets","ServerSentEvents","LongPolling"]}
  </code></pre>
  
  <p>That means there is no restrictions in terms of transfer formats? Not sure if that's relevant either...It's very weird, it's the same thing that happens here: <a href="https://stackoverflow.com/questions/49765667/signalr-no-transport">SignalR no transport</a></p>
  
  <p>------UPDATE END--------</p>
  
  <p>So my questions are:</p>
  
  <p>Have I broken SignalR connectivity because I did set the <code>proxy_buffer</code>? If so, is there a way to get both IS4 and SignalR running behind the same Nginx instance? - To make things more difficult I'm using an Nginx template that gets autogenerated using docker-gen.</p>
  
  <p>If my changes to Nginx shouldn't break SignalR, why is not establishing the connection?</p>
  
  <p>Thanks!</p>
  
  <p><strong>UPDATE! FOUND THE ISSUE!!!</strong></p>
  
  <p>I write this because I think that can be useful for someone else.</p>
  
  <p>The problem I had was that I was using preview1 on both the client and the API but back in the day when I created the <code>Dockerfile</code> I couldn't get the <code>FROM microsoft/dotnet:2.1.0-preview1-aspnetcore-runtime</code> to work so I chose to use <code>preview2</code>: <code>FROM microsoft/dotnet:2.1.0-preview2-aspnetcore-runtime</code> and that was the problem. Now I quickly changed the client and the API to use preview of SignalR and I could get the connection to work. Happy days! Hope this el helpful :) So not only client and API need matching but the actual docker image needs to be aligned as well.</p>