title: ASP.NET Core 3 Blazor: Run on localhost of server ok, but run outside server error: Error during WebSocket handshake: Unexpected response code: 200
body: <p>I am using .NET Core 3.0.0 , Blazor server-side, Visual Studio 2019, Windows Server 2016. I run on server ok, but connection from outside server is error.</p>
  
  <p>I use Apache HTTP Web server 2.4 virtual host (<a href="http://httpd.apache.org/docs/2.4/vhosts/" rel="nofollow noreferrer">http://httpd.apache.org/docs/2.4/vhosts/</a> ), file <code>httpd-vhosts.conf</code></p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
      ProxyPreserveHost On
      ProxyPass / http://127.0.0.1:5000/
      ProxyPassReverse / http://127.0.0.1:5000/
      ServerName demo.example.com
      ErrorLog ${APACHE_LOG_DIR}webapp1-error.log
      CustomLog ${APACHE_LOG_DIR}webapp1-access.log common
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>In <code>httpd.conf</code> , enable module: <code>proxy</code> , <code>proxy_httpd</code> , <code>proxy_wstunnel</code> and</p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
    ServerName demo.example.com
  
    RewriteEngine On
    RewriteCond %{REQUEST_URI}  ^/demo.example.com            [NC]
    RewriteCond %{QUERY_STRING} transport=websocket    [NC]
    RewriteRule /(.*)           ws://localhost:5000/$1 [P,L]
  
    ProxyPass / http://localhost:5000/
    ProxyPassReverse / http://localhost:5000/
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>this error</p>
  
  <blockquote>
    <p>blazor.server.js:1 WebSocket connection to
    'ws://demo.xxxx.xx/_blazor?id=LZk17pmIejWGHLkhN3HFmA' failed: Error
    during WebSocket handshake: Unexpected response code: 200</p>
  </blockquote>