-
-
Notifications
You must be signed in to change notification settings - Fork 209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: proxy passthrough when no match? #148
Comments
Your setup looks fine. What happens if you just define the proxy and send a request ? See also this example |
Makes no difference. The url I proxy to is also in my hosts file. Could that be an issue? |
What happens if you just try https://www.google.com ? |
Using https://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): {
"Guid": "c9cc3288-102e-42fa-87f9-87b693c32c3d",
"RequestMessage": {
"ClientIP": "127.0.0.1",
"Url": "https://my-url.com/with/some/path",
"DateTime": "2018-06-05T20:43:05.2735592+02:00",
"Path": "/with/some/path",
"PathSegments": [
"with",
"some",
"path"
],
"Method": "post",
"Headers": {
"Connection": [
"keep-alive"
],
"Content-Type": [
"text/xml"
],
"Accept": [
"*/*"
],
"Accept-Encoding": [
"gzip, deflate"
],
"Host": [
"my-url.com"
],
"User-Agent": [
"PostmanRuntime/7.1.5"
],
"Content-Length": [
"876"
]
},
"Cookies": null,
"Query": null,
"RawQuery": "",
"Body": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<soap:Envelope xmlns:soap=\"https://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"https://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"https://www.w3.org/2001/XMLSchema-instance\">\r\n ... the soap request body here ... </soap:Envelope>",
"BodyAsJson": null,
"BodyAsBytes": null,
"Host": "my-url.com",
"Protocol": "http",
"Port": 80,
"Origin": "https://my-url.com:80",
"BodyEncoding": {
"BodyName": "utf-8",
"EncodingName": "Unicode (UTF-8)",
"HeaderName": "utf-8",
"WebName": "utf-8",
"WindowsCodePage": 1200,
"IsBrowserDisplay": true,
"IsBrowserSave": true,
"IsMailNewsDisplay": true,
"IsMailNewsSave": true,
"IsSingleByte": false,
"EncoderFallback": {
"DefaultString": "?",
"MaxCharCount": 1
},
"DecoderFallback": {
"DefaultString": "?",
"MaxCharCount": 1
},
"IsReadOnly": true,
"CodePage": 65001
}
},
"ResponseMessage": {
"Headers": {
"Content-Type": [
"text/xml; charset=UTF-8"
],
"Content-Language": [
"nl-NL"
],
"Connection": [
"Keep-Alive"
],
"Date": [
"Tue, 05 Jun 2018 18:43:05 GMT"
],
"Keep-Alive": [
"timeout=10, max=100"
],
"Transfer-Encoding": [
"chunked"
],
"X-Powered-By": [
"Servlet/3.0",
"Servlet/3.0"
],
"X-Pad": [
"avoid browser bug"
]
},
"StatusCode": 200,
"BodyOriginal": null,
"BodyDestination": null,
"Body": "<soap:Envelope xmlns:soap=\"https://schemas.xmlsoap.org/soap/envelope/\">... some soap response body here ...</soap:Envelope>",
"BodyAsJson": null,
"BodyAsJsonIndented": null,
"BodyAsBytes": null,
"BodyAsFile": null,
"BodyAsFileIsCached": null,
"BodyEncoding": {
"BodyName": "utf-8",
"EncodingName": "Unicode (UTF-8)",
"HeaderName": "utf-8",
"WebName": "utf-8",
"WindowsCodePage": 1200,
"IsBrowserDisplay": true,
"IsBrowserSave": true,
"IsMailNewsDisplay": true,
"IsMailNewsSave": true,
"IsSingleByte": false,
"EncoderFallback": {
"DefaultString": "?",
"MaxCharCount": 1
},
"DecoderFallback": {
"DefaultString": "?",
"MaxCharCount": 1
},
"IsReadOnly": true,
"CodePage": 65001
}
},
"RequestMatchResult": {
"TotalScore": 2.0,
"TotalNumber": 2,
"IsPerfectMatch": true,
"AverageTotalScore": 1.0,
"MatchDetails": [
{
"Key": "WireMock.Matchers.Request.RequestMessageMethodMatcher, WireMock.Net, Version=1.0.3.20, Culture=neutral, PublicKeyToken=null",
"Value": 1.0
},
{
"Key": "WireMock.Matchers.Request.RequestMessagePathMatcher, WireMock.Net, Version=1.0.3.20, Culture=neutral, PublicKeyToken=null",
"Value": 1.0
}
]
},
"MappingGuid": "6a9079dd-e61f-445d-950e-dc44431c970c",
"MappingTitle": null
} But in Postman and SoapUI I still get no response back |
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. |
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. |
You're welcome! Which framework do you use to run wiremock?
|
Im currently on .net core 2.0, but I also tried .net 4.5.2. Same problem unfortunately |
@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. |
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 |
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 ? |
Mmm. Maybe this link has a solution. I will take a look and see if this error can be simulated. |
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. |
See linked changeset f1896ef for some details on how this will be fixed. Please take a look and comment. |
Great, thanks for the quick reply! I commented on the commit |
Closing. New NuGet with this solution will be added in some time. |
* WebHeaderCollection.IsRestricted (#148) * Update dependencies * 1.0.4.7
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.LogEntriesChanged
event handler I see the response from my actual endpoint returning properly, but it is not passed through to the caller?The text was updated successfully, but these errors were encountered: