aspnet / AspNetCoreModule

ASP.NET Core Module for IIS and IIS Express
Other
115 stars 31 forks source link

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

Open shirhatti opened 7 years ago

shirhatti commented 7 years ago

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

We need to further investigate this

shirhatti commented 7 years ago
  1. Create URLRewrite application as the following

    <application path="/URLRewrite">
    <virtualDirectory path="/" physicalPath="c:\inetpub\wwwroot\URLRewrite" />
    </application>
  2. 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>
  3. 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.

muratg commented 7 years ago

👀

ArtemAvramenko commented 6 years ago

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