mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-08-01 01:38:35 +02:00
Proxy/Intercept pattern is throwing a keep alive header error with net461 #53
Closed
opened 2025-12-29 14:21:47 +01:00 by adam
·
5 comments
No Branch/Tag Specified
master
1341-mapping-json
stef-aspire-tests-updates
bug/973-TinyMapper
bug/1149-AppendGuidToSavedMappingFile
feature/1150-DockerImageVersion
61
stef-1108
stef-1097
stef-1083-MessageOptions_Type_Conflict
stef-1062-logger
stef-IgnoreOpenApiErrors
stef-928-TypeLoadException-FluentAssertions-net472
nunit
stef-849
stef-847-regex-questionmark
http_verb
WireMockServerContext
webapp
ai
CommandLineArgumentsParser
2.13.0
2.12.0
2.11.0
2.10.0
2.9.0
2.8.0
2.7.0
2.6.0
2.5.0
2.4.0
2.3.0
2.2.0
2.1.0
2.0.0
1.25.0
1.24.0
1.23.0
1.22.0
1.21.0
1.20.0
1.19.0
1.18.0
1.17.0
1.16.0
1.15.0
1.14.0
1.13.0
1.12.0
1.11.2
1.11.0
1.10.1
1.10.0
1.9.1
1.9.0
1.8.18
1.8.17
1.8.16
1.8.15
1.8.14
1.8.13
1.8.12
1.8.11
1.8.10
1.8.9
1.8.8
1.8.7
1.8.6
1.8.5
1.8.3
1.8.2
1.8.1
1.8.0
1.7.4
1.7.3
1.7.2
1.7.1
1.7.0
1.6.12
1.6.11
1.6.10
1.6.9
1.6.8
1.6.7
1.6.6
1.6.5
1.6.4
1.6.3
1.6.2
1.6.1
1.6.0
1.5.62
1.5.61
1.5.60
1.5.59
1.5.58
1.5.57
1.5.56
1.5.55
1.5.54
1.5.53
1.5.52
1.5.51
1.5.50
1.5.49
1.5.48
1.5.47
1.5.46
1.5.45
1.5.44
1.5.43
1.5.42
1.5.41
1.5.40
1.5.39
1.5.38
1.5.37
1.5.36
1.5.35
1.5.34
1.5.33
1.5.32
1.5.31
1.5.30
1.5.29
1.5.28
1.5.27
1.5.26
1.5.25
1.5.24
1.5.23
1.5.22
1.5.21
1.5.20
1.5.19
1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.0.4.11
1.0.4.10
1.0.4.9
1.0.4.8
1.0.4.7
1.0.4.6
1.0.4.5
1.0.4.4
1.0.4.3
1.0.4.2
1.0.4.1
1.0.4.0
1.0.3.20
1.0.3.19
1.0.3.18
1.0.3.17
1.0.3.16
1.0.3.15
1.0.3.14
1.0.3.13
1.0.3.12
1.0.3.11
1.0.3.10
1.0.3.9
1.0.3.8
1.0.3.7
1.0.3.6
1.0.3.5
1.0.3.4
1.0.3.3
1.0.3.2
1.0.3.1
1.0.3.0
1.0.2.13
1.0.2.12
1.0.2.11
1.0.2.10
1.0.2.9
1.0.2.8
1.0.2.7
1.0.2.6
1.0.2.5
1.0.2.4
1.0.2.1
1.0.2.0
1.0.1.5
1.0.1.3
1.0.1.2
1.0.1.1
1.0.0.0
No labels
Milestone
No items
No Milestone
Projects
Clear projects
No projects
Assignees
adam (Adam Melkus)
Clear assignees
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: starred/WireMock.Net-wiremock#53
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @josh-curtis90 on GitHub (Dec 7, 2017).
Originally assigned to: @StefH on GitHub.
Hello!
Trying to get proxying working with the following example:
FluentMockServer server = FluentMockServer.StartWithAdminInterface(port: 8088); server.Given(Request.Create().WithPath("*")).AtPriority(10).RespondWith(Response.Create().WithProxy("http://restcountries.eu/"));But its throwing me this:
{ "ClassName": "System.ArgumentException", "Message": "The 'Keep-Alive' header must be modified using the appropriate property or method.", "Data": null, "InnerException": null, "HelpURL": null, "StackTraceString": " at System.Net.WebHeaderCollection.ThrowOnRestrictedHeader(String headerName)\r\n at System.Net.WebHeaderCollection.Set(String name, String value)\r\n at Microsoft.Owin.Host.HttpListener.RequestProcessing.ResponseHeadersDictionary.Set(String header, String value)\r\n at Microsoft.Owin.Host.HttpListener.RequestProcessing.HeadersDictionaryBase.Set(String key, String[] value)\r\n at WireMock.Owin.OwinResponseMapper.<>c__DisplayClass1_0.<MapAsync>b__1(KeyValuePair'2 pair)\r\n at System.Collections.Generic.List'1.ForEach(Action'1 action)\r\n at WireMock.Owin.OwinResponseMapper.<MapAsync>d__1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at WireMock.Owin.WireMockMiddleware.<Invoke>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at WireMock.Owin.GlobalExceptionMiddleware.<Invoke>d__2.MoveNext()", "RemoteStackTraceString": null, "RemoteStackIndex": 0, "ExceptionMethod": "8\nThrowOnRestrictedHeader\nSystem, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\nSystem.Net.WebHeaderCollection\nVoid ThrowOnRestrictedHeader(System.String)", "HResult": -2147024809, "Source": "System", "WatsonBuckets": null, "ParamName": "name" }I can see in the request log however that the request is proxied properly:
[ { "Guid": "8c509c3a-db4e-407f-baf1-7e8eecb5e408", "Request": { "ClientIP": "::1", "DateTime": "2017-12-07T19:30:36.7224812+00:00", "Path": "/rest/v2/all", "AbsoluteUrl": "http://localhost:8088/rest/v2/all", "Method": "get", "Headers": { "Postman-Token": [ "a936e818-4c09-49f5-a3b1-efebdd6bedcc" ], "Cache-Control": [ "no-cache" ], "Connection": [ "keep-alive" ], "Accept": [ "*/*" ], "Accept-Encoding": [ "gzip, deflate" ], "Host": [ "localhost:8088" ], "User-Agent": [ "PostmanRuntime/7.1.1" ] } }, "Response": { "StatusCode": 200, "Headers": { "Keep-Alive": [ "timeout=5, max=100" ], "Access-Control-Allow-Methods": [ "GET" ], "Access-Control-Allow-Headers": [ "Accept, X-Requested-With" ], "Content-Type": [ "application/json; charset=utf-8" ], "Access-Control-Allow-Origin": [ "*" ], "Date": [ "Thu, 07 Dec 2017 19:30:37 GMT" ], "Connection": [ "Keep-Alive" ], "Transfer-Encoding": [ "chunked" ], "Server": [ "Apache/2.4.25", "(Debian)" ], "Cache-Control": [ "public, max-age=86400" ] }, "Body": "[{\"name\":\"Afghanistan\",\"topLevelDomain\":[\".af\"],\"alpha2Code\":\"AF\",\"alpha3Code\":\"AFG\",\"callingCodes\":[\"93\"],\"capital\":\"Kabul\",\"altSpellings\":[\"AF\",\"Afġānistān\"],\"region\":\"Asia\",\"subregion\":\"Southern Asia\",\"population\":27657145,\"latlng\":[33.0,65.0],\"demonym\":\"Afghan\",\"area\":652230.0,\"gini\":27.8,\"timezones\":[\"UTC+04:30\"],\"borders\":[\"IRN\",\"PAK\",\"TKM\",\"UZB\",\"TJK\",\"CHN\"],\"nativeName\":\"افغانستان\",\"numericCode\":\"004\",\"currencies\":[{\"code\":\"AFN\",\"name\":\"Afghan afghani\",\"symbol\":\"؋\"}],\"languages\":[{\"iso639_1\":\"ps\",\"iso639_2\":\"pus\",\"name\":\"Pashto\",\"nativeName\":\"پښتو\"},{\"iso639_1\":\"uz\",\"iso639_2\":\"uzb\",\"name\":\"Uzbek\",\"nativeName\":\"Oʻzbek\"},{\"iso639_1\":\"tk\",\"iso639_2\":\"tuk\",\"name\":\"Turkmen\",\"nativeName\":\"Türkmen\"}],\"translations\":{\"de\":\"Afghanistan\",\"es\":\"Afganistán\",\"fr\":\"Afghanistan\",\"ja\":\"アフガニスタン\",\"it\":\"Afghanistan\",\"br\":\"Afeganistão\",\"pt\":\"Afeganistão\",\"nl\":\"Afghanistan\",\"hr\":\"Afganistan\",\"fa\":\"افغانستان\"},\"flag\":\"https://restcountries.eu/data/afg.svg\",\"regionalBlocs\":[{\"acronym\":\"SAARC\",\"name\":\"South Asian Association for Regional Cooperation\",\"otherAcronyms\":[],\"otherNames\":[]}],\"cioc\":\"AFG\"},{\"name\":\"Åland Islands\",\"topLevelDomain\":[\".ax\"],\"alpha2Code\":\"AX\",\"alpha3Code\":\"ALA\",\"callingCodes\":[\"358\"],\"capital\":\"Mariehamn\",\"altSpellings\":[\"AX\",\"Aaland\",\"Aland\",\"Ahvenanmaa\"],\"region\":\"Europe\",\"subregion\":\"Northern Europe\",\"population\":28875,\"latlng\":[60.116667,19.9],\"demonym\":\"Ålandish\",\"area\":1580.0,\"gini\":null,\"timezones\":[\"UTC+02:00\"],\"borders\":[],\"nativeName\":\"Åland\",\"numericCode\":\"248\",\"currencies\":[{\"code\":\"EUR\",\"name\":\"Euro\",\"symbol\":\"€\"}],\"languages\":[{\"iso639_1\":\"sv\",\"iso639_2\":\"swe\",\"name\":\"Swedish\",\"nativeName\":\"svenska\"}],\"translations\":{\"de\":\"Åland\",\"es\":\"Alandia\",\"fr\":\"Åland\",\"ja\":\"オーランド諸島\",\"it\":\"Isole Aland\",\"br\":\"Ilhas de Aland\",\"pt\":\"Ilhas de Aland\",\"nl\":\"Ålandeilanden\",\"hr\":\"Ålandski otoci\",\"fa\":\"جزایر الند\"},\"flag\":\"https://restcountries.eu/data/ala.svg\",\"regionalBlocs\":[{\"acronym\":\"EU\",\"name\":\"European Union\",\"otherAcronyms\":[],\"otherNames\":[]}],\"cioc\":\"\"},{\"name\":\"Albania\",\"topLevelDomain\": ... etc.Any ideas what I'm doing wrong?
@StefH commented on GitHub (Dec 7, 2017):
I can imagine that Keep-Alive is a reserved header.
Are you using netcore or .net 4.x ?
@josh-curtis90 commented on GitHub (Dec 7, 2017):
net4.6.1, I'm not explicitly setting any headers.
@StefH commented on GitHub (Dec 7, 2017):
New NuGet is uploaded, please retest.
@josh-curtis90 commented on GitHub (Dec 7, 2017):
Great! Amazing turn around time. Will re-test once back in office and let you know. Thanks.
@josh-curtis90 commented on GitHub (Dec 8, 2017):
This is working now, thanks for the quick assist!