-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Closed
Labels
area-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesbugThis issue describes a behavior which is not expected - a bug.This issue describes a behavior which is not expected - a bug.feature-spa
Milestone
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
When running an ASP.NET SPA site which uses .UseProxyToSpaDevelopmentServer()
, the following kind of URL breaks the proxying:
https://localhost:44381//foo/bar
This is because internally, SpaProxy
is constructing a Uri
like this:
var targetUri = new Uri(
baseUri,
context.Request.Path + context.Request.QueryString);
If the second argument begins //
, Uri
treats it as an absolute path and throws away baseUri
. A period .
needs to be prefixed to the relative URI to avoid this behaviour.
Expected Behavior
The URL will proxy successfully and not break.
Steps To Reproduce
Setup an ASP.NET SPA site, and try to access any path on the local server beginning with a double-slash. eg. https://localhost:44381//foo/bar
Exceptions (if any)
System.Net.Http.HttpRequestException
Failed to proxy the request to http://aa/b, because the request to the proxy target failed. Check that the proxy target server is running and accepting requests to http://localhost:3000/.\n\nThe underlying exception message was 'No such host is known. (aa:80)'.Check the InnerException for more details.
.NET Version
5.0.411
Anything else?
No response
Metadata
Metadata
Assignees
Labels
area-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesbugThis issue describes a behavior which is not expected - a bug.This issue describes a behavior which is not expected - a bug.feature-spa