AspNetCoreModule icon indicating copy to clipboard operation
AspNetCoreModule copied to clipboard

WebSocket does not work if the server URL is remapped with URLRewrite rule

Open shirhatti opened this issue 8 years ago • 3 comments
trafficstars

Customer has also reported a similar issue with ARR https://github.com/aspnet/SignalR/issues/911

We need to further investigate this

shirhatti avatar Sep 20 '17 23:09 shirhatti

  1. Create URLRewrite application as the following
<application path="/URLRewrite">
  <virtualDirectory path="/" physicalPath="c:\inetpub\wwwroot\URLRewrite" />
</application>
  1. Put the following web.config to the c:\inetpub\wwwroot\URLRewrite
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <rule name="Rewrite to article.aspx">
          <match url="^rewrite/([_0-9a-z-]+)/([_0-9a-z-]+)" />
          <action type="Rewrite" url="/{R:1}/{R:2}" />
        </rule>
      </rules>
    </rewrite> 
  </system.webServer> 
</configuration>
  1. On the websocket client program use the below WebSocket URL which will be redirected to ws://localhost:8080/websocketecho/test where actual websocket server app of Aspnetcore is located ws://localhost:8080/URLRewrite/rewrite/websocketecho/test

EXPECTED:

Websocket client can connect the websocket server.

ACTUAL:

Websocket client can't connect the websocket server.

shirhatti avatar Sep 20 '17 23:09 shirhatti

👀

muratg avatar Sep 21 '17 21:09 muratg

Will the problem be resolved if I switch to some other reverse proxy than UrlRewrite module?

ArtemAvramenko avatar Aug 02 '18 16:08 ArtemAvramenko