mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 22:30:41 +01:00
Question: proxy passthrough when no match? #107
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 @josdeweger-zz on GitHub (May 30, 2018).
Is there a way to configure the proxy so that when there is no match, the request is passed through to the endpoint and passed back via the proxy to the client?
I have the following setup:
When I hit an exact match, I get the expected response back. But when there is no match, I get nothing back and the request times out. In the
_server.LogEntriesChangedevent handler I see the response from my actual endpoint returning properly, but it is not passed through to the caller?@StefH commented on GitHub (Jun 3, 2018):
Your setup looks fine.
What happens if you just define the proxy and send a request ?
See also this example
https://github.com/WireMock-Net/WireMock.Net/blob/master/examples/WireMock.Net.ConsoleApplication/MainApp.cs#L89
@josdeweger-zz commented on GitHub (Jun 4, 2018):
Makes no difference. The url I proxy to is also in my hosts file. Could that be an issue?
@StefH commented on GitHub (Jun 5, 2018):
What happens if you just try http://www.google.com ?
@josdeweger-zz commented on GitHub (Jun 5, 2018):
Using http://www.google.com seems to work just fine.
When using my own url, I'm getting the following response displayed using the LogEntriesChanged event (removed some of the sensitive content and changed the url and path, but the idea is the same):
But in Postman and SoapUI I still get no response back
@StefH commented on GitHub (Jun 5, 2018):
The LogRequest seems ok.
Just a quick question: is your wiremock and that my.url.com just running on http or so you want to proxy from https to http, or from http to https? Maybe that could an issue?
In case of https, there could be an issue with self-signed certificates, these are default blocked by postman.
@josdeweger-zz commented on GitHub (Jun 5, 2018):
Before replying, let me say: thanks for your quick reply, love this library and your support. Keep up the good work!
To reply to your question: it's http only, and I tried both Postman and SoapUI. If I have the opportunity I will ask a colleague to pull down my branch and test it on another machine.
@StefH commented on GitHub (Jun 6, 2018):
You're welcome!
Which framework do you use to run wiremock?
@josdeweger-zz commented on GitHub (Jun 21, 2018):
Im currently on .net core 2.0, but I also tried .net 4.5.2. Same problem unfortunately
@StefH commented on GitHub (Jun 29, 2018):
@josdeweger Any update on this issue? Did you get it working? Or still an issue?
Note that if proxying to google.com works, the issue must be in your network or backend server.
@josdeweger-zz commented on GitHub (Jun 29, 2018):
I recently asked a colleague to try the same setup to rule out the problem only occurs on my machine, but unfortunately the response is also not returned on his machine.
Let me try and see if I can spot differences in request/response using Fiddler comparing with and without Wiremock
@josdeweger-zz commented on GitHub (Jul 17, 2018):
Hi @StefH,
I gave it another try, created a new Console application using .net framework 4.7, using WireMock.Net.Standalone 1.0.4.5:
I get a response now, with the following error:
Looks very similar to #70 ?
@StefH commented on GitHub (Jul 17, 2018):
Mmm.
Maybe this link has a solution.
https://stackoverflow.com/questions/239725/cannot-set-some-http-headers-when-using-system-net-webrequest
I will take a look and see if this error can be simulated.
@StefH commented on GitHub (Jul 18, 2018):
I can reproduce with NET 4.5.x project, I get same exception. When using a dotnetcore project, it just works so it seems ?
I will investigate a solution.
@StefH commented on GitHub (Jul 19, 2018):
See linked changeset
f1896ef73afor some details on how this will be fixed.Please take a look and comment.
@josdeweger-zz commented on GitHub (Jul 19, 2018):
Great, thanks for the quick reply! I commented on the commit
@StefH commented on GitHub (Jul 19, 2018):
Closing.
New NuGet with this solution will be added in some time.