Encoded url path parameter decoded via proxy #595

Closed
opened 2025-12-29 15:27:54 +01:00 by adam · 0 comments
Owner

Originally created by @adsk-duszykf on GitHub (May 3, 2024).

Originally assigned to: @StefH on GitHub.

Describe the bug

An encoded url parameter looks decoded by WireMock server. My code sends a request like : POST http://localhost:4200/api/file%3Atest.pdf to Wiremock proxy server. The url is then transformed to POST https://webservie.com/api/file:test.pdf. Here the url encoded parameter file%3Atest.pdf is decoded and forwarded as file:test.pdf which generate an error from the webservice

I

Expected behavior:

I expect that encoded url parameter are not decoded

Test to reproduce

  1. Create a mock server with proxy (here is my code)
MockServer = WireMockServer.Start(new WireMockServerSettings
{
    Urls = [BaseProxyURL],
    FileSystemHandler = new LocalFileSystemHandler(recordingPath),
});

MockServer
    .Given(Request.Create().WithPath($"*/service/*"))
    .RespondWith(Response.Create()
        .WithProxy(new ProxyAndRecordSettings
        {
            Url = "https://webservice.com/",

            SaveMapping = true,
            SaveMappingToFile = true,
            ExcludedHeaders = ["Authorization"],
            ReplaceSettings = new ProxyUrlReplaceSettings
            {
                OldValue = $"/service",
                NewValue = ""
            }
        })
    );
  1. Capture the outbound traffic with fiddler
  2. Send a request containing an encoded url parameter
Originally created by @adsk-duszykf on GitHub (May 3, 2024). Originally assigned to: @StefH on GitHub. ### Describe the bug An encoded url parameter looks decoded by WireMock server. My code sends a request like : `POST http://localhost:4200/api/file%3Atest.pdf ` to Wiremock proxy server. The url is then transformed to `POST https://webservie.com/api/file:test.pdf`. Here the url encoded parameter `file%3Atest.pdf` is decoded and forwarded as `file:test.pdf` which generate an error from the webservice I ### Expected behavior: I expect that encoded url parameter are not decoded ### Test to reproduce 1. Create a mock server with proxy (here is my code) ```` csharp MockServer = WireMockServer.Start(new WireMockServerSettings { Urls = [BaseProxyURL], FileSystemHandler = new LocalFileSystemHandler(recordingPath), }); MockServer .Given(Request.Create().WithPath($"*/service/*")) .RespondWith(Response.Create() .WithProxy(new ProxyAndRecordSettings { Url = "https://webservice.com/", SaveMapping = true, SaveMappingToFile = true, ExcludedHeaders = ["Authorization"], ReplaceSettings = new ProxyUrlReplaceSettings { OldValue = $"/service", NewValue = "" } }) ); ```` 2. Capture the outbound traffic with fiddler 3. Send a request containing an encoded url parameter
adam added the wontfix label 2025-12-29 15:27:54 +01:00
adam closed this issue 2025-12-29 15:27:54 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/WireMock.Net-wiremock#595