mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 21:10:32 +01:00
Proxying always goes to the root #579
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @JorisVanEijden on GitHub (Mar 1, 2024).
Originally assigned to: @StefH on GitHub.
Describe the bug
ProxyAndRecordSettings.Url = "https://www.example.com/some/sub/paths"
A request for "/someurl" is proxied to "https://www.example.com/someurl"
Expected behavior:
A request for "/someurl" is proxied to "https://www.example.com/some/sub/paths/someurl"
Other related info
The path to proxy to is determined by
var proxyUriWithRequestPathAndQuery = new Uri(proxyUri, requestUri.PathAndQuery);Since
requestUri.PathAndQuerywill always start with a slash, the created uri will always only take the root of theproxyUriand ignore the sub paths.*edit: A workaround:
@StefH commented on GitHub (Mar 2, 2024):
Hi @JorisVanEijden
The ProxyUrlReplaceSettings are indeed the correct way to implement your requirements.
See also this unit-test: https://github.com/WireMock-Net/WireMock.Net/blob/master/test/WireMock.Net.Tests/WireMockServer.Proxy.cs#L574
See also these issues and PR's