@@ -35,7 +35,7 @@ public void Configure(IApplicationBuilder app) => app
3535 . UseResponseCompression ( )
3636 . Use ( VaryAccept )
3737 . Use ( CatchAndDisplayErrors )
38- . Use ( SqlStreamStreamBrowserJavascript )
38+ . Use ( SqlStreamStreamBrowserStatic )
3939 . Use ( SqlStreamStreamBrowserHtml )
4040 . UseSqlStreamStoreHal ( _streamStore ) ;
4141
@@ -55,34 +55,25 @@ public void Configure(IApplicationBuilder app) => app
5555 {
5656 Task Vary ( object state )
5757 {
58- var response = ( HttpResponse ) state ;
58+ var response = ( HttpResponse ) state ;
5959
6060 response . Headers . AppendCommaSeparatedValues ( "Vary" , "Accept" ) ;
6161
6262 return Task . CompletedTask ;
6363 }
64-
64+
6565 context . Response . OnStarting ( Vary , context . Response ) ;
66-
66+
6767 return next ( ) ;
6868 } ;
6969
70- private MidFunc SqlStreamStreamBrowserJavascript => ( context , next ) =>
71- {
72- if ( context . Request . Path . Value ? . EndsWith ( ".js" ) ?? false )
73- {
74- var segments = context . Request . Path . ToUriComponent ( ) . Split ( '/' ) ;
75- if ( segments . Length > 2 )
76- {
77- return RedirectToPathBase ( context , $ "/{ segments . Last ( ) } ") ;
78- }
79-
80- return ForwardToClientDevServer (
70+ private MidFunc SqlStreamStreamBrowserStatic => ( context , next )
71+ => context . Request . Path . StartsWithSegments ( new PathString ( "/static" ) )
72+ || context . Request . Path . StartsWithSegments ( new PathString ( "/sockjs-node" ) )
73+ ? ForwardToClientDevServer (
8174 context ,
82- context . Request . PathBase + context . Request . Path ) ;
83- }
84- return next ( ) ;
85- } ;
75+ context . Request . Path )
76+ : next ( ) ;
8677
8778 private MidFunc SqlStreamStreamBrowserHtml => ( context , next )
8879 => GetAcceptHeaders ( context . Request )
@@ -100,7 +91,7 @@ private static string[] GetAcceptHeaders(HttpRequest contextRequest)
10091 private Task RedirectToPathBase ( HttpContext context , PathString path )
10192 {
10293 context . Response . Redirect ( context . Request . PathBase + path ) ;
103-
94+
10495 return Task . CompletedTask ;
10596 }
10697
0 commit comments