ConditionalProxyMiddleware throws when webpack output.publicPath is relative #1571

Closed
opened 2025-08-09 17:20:41 +00:00 by fergalmoran · 0 comments
Owner

Originally created by @rmja on 6/10/2016

The ConditionalProxyMiddleware throws when webpack output.publicPath is relative, which is useful when the app is hosted on a, for the app, unknown path base.

this line should ensure that that the path prefix starts with a '/', such that this line does not throw. Something like _pathPrefix = '/' + pathPrefix.TrimStart('/'); should work.

*Originally created by @rmja on 6/10/2016* The ConditionalProxyMiddleware throws when webpack output.publicPath is relative, which is useful when the app is hosted on a, for the app, unknown path base. [this line](https://github.com/aspnet/JavaScriptServices/blob/master/src/Microsoft.AspNetCore.SpaServices/Webpack/ConditionalProxyMiddleware.cs#L30) should ensure that that the path prefix starts with a '/', such that [this line](https://github.com/aspnet/JavaScriptServices/blob/master/src/Microsoft.AspNetCore.SpaServices/Webpack/ConditionalProxyMiddleware.cs#L37) does not throw. Something like `_pathPrefix = '/' + pathPrefix.TrimStart('/');` should work.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/JavaScriptServices#1571
No description provided.