File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed
src/Microsoft.AspNetCore.SpaServices/Webpack Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ internal class ConditionalProxyMiddleware
2222 private readonly RequestDelegate _next ;
2323 private readonly ConditionalProxyMiddlewareOptions _options ;
2424 private readonly string _pathPrefix ;
25+ private readonly bool _pathPrefixIsRoot ;
2526
2627 public ConditionalProxyMiddleware (
2728 RequestDelegate next ,
@@ -35,14 +36,15 @@ public ConditionalProxyMiddleware(
3536
3637 _next = next ;
3738 _pathPrefix = pathPrefix ;
39+ _pathPrefixIsRoot = string . Equals ( _pathPrefix , "/" , StringComparison . Ordinal ) ;
3840 _options = options ;
3941 _httpClient = new HttpClient ( new HttpClientHandler ( ) ) ;
4042 _httpClient . Timeout = _options . RequestTimeout ;
4143 }
4244
4345 public async Task Invoke ( HttpContext context )
4446 {
45- if ( context . Request . Path . StartsWithSegments ( _pathPrefix ) )
47+ if ( context . Request . Path . StartsWithSegments ( _pathPrefix ) || _pathPrefixIsRoot )
4648 {
4749 var didProxyRequest = await PerformProxyRequest ( context ) ;
4850 if ( didProxyRequest )
Original file line number Diff line number Diff line change @@ -17,7 +17,10 @@ public static class WebpackDevMiddleware
1717
1818 private static readonly JsonSerializerSettings jsonSerializerSettings = new JsonSerializerSettings
1919 {
20- ContractResolver = new CamelCasePropertyNamesContractResolver ( ) ,
20+ // Note that the aspnet-webpack JS code specifically expects options to be serialized with
21+ // PascalCase property names, so it's important to be explicit about this contract resolver
22+ ContractResolver = new DefaultContractResolver ( ) ,
23+
2124 TypeNameHandling = TypeNameHandling . None
2225 } ;
2326
You can’t perform that action at this time.
0 commit comments