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.
I use Apache HTTP Web server 2.4 virtual host (http://httpd.apache.org/docs/2.4/vhosts/ ), file httpd-vhosts.conf
<VirtualHost *:80>
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
</VirtualHost>
In httpd.conf
, enable module: proxy
, proxy_httpd
, proxy_wstunnel
and
<VirtualHost *:80>
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/
</VirtualHost>
this error
blazor.server.js:1 WebSocket connection to 'ws://demo.xxxx.xx/_blazor?id=LZk17pmIejWGHLkhN3HFmA' failed: Error during WebSocket handshake: Unexpected response code: 200
http://localhost:5000
on server to sub-domaindemo.bkit.vn
for publishing. - Do Nhu Vy