wiremock / wiremock/WireMock.Net

403 forbidden when using proxy wiremock in c# unit test

Open
#1,257 5 comments 0 reactions 1 assignee View on GitHub

@StefH is already working on this.

Since Feb 27, 2025.

wontfix
Dominant language
C#
Stars
1.7k
Forks
240
Avg merge
5d 12h
Merged PRs (30d)
2

Description

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

I’ve created an unit test using wiremocknet. I’ve setup so that instead of targeting https://mycompany/private/ it instead target http://localhost:8080/ that forward it then to the https://myco mpany/private

By using Wiremockserver.Start and setting a Logger and an proxyAndRecordSettings.

The issue is that I always have 403 forbidden.
I know that the forward work otherwise I would have no response.
I know the header with authentication are correctly feeded to my http client as I have only switch the url.

By using postman I can see my header correctly fed (if I’m not mistaken)

But it seems wiremock net jinx my auth
Describe the solution you'd like
A clear and concise description of what you want to happen.

Correct forward of header for auth when calling api in forward and record mode

Describe alternatives you've considered
Installed wiremock Java locally to do the forward and record and it worked

Is your feature request supported by WireMock (java version)? Please provide details.
Wiremock Java locally works but I want the net version to be able to have an unit test that record all call to external api so that after record all call are mocked and stored

Additional context
Add any other context or screenshots about the feature request here.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.