mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 14:20:29 +01:00
WireMock not working when attempting to access from anything other than localhost. #55
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 @josh-curtis90 on GitHub (Jan 17, 2018).
Hi there,
I've run into an issue when trying to access a wiremock mock instance running on 0.0.0.1 FROM an application running on 0.0.0.2 using http://0.0.0.1/things/other-things.
Can be replicated much simpler by trying to access a wiremock standalone instance on your local machine on your IP rather than localhost.
I'm getting a 400 Invalid Hostname.
Tried this using the java version of wiremock standalone also and it working fine.
Any ideas?
Cheers,
Josh
@josh-curtis90 commented on GitHub (Jan 17, 2018):
Just seen https://github.com/WireMock-Net/WireMock.Net/blob/master/src/WireMock.Net/Server/FluentMockServer.cs#L156.
I'm using a dynamic ports which is hardcoding the URL to be "localhost" + port.
@josh-curtis90 commented on GitHub (Jan 17, 2018):
Whoops didn't mean to close.
I can get around this by using the PortUtil; in my calling code, so I guess its a non-issue unless you intended it to work differently?
@StefH commented on GitHub (Jan 17, 2018):
You could use 'http://*:80' for an url? Which makes WireMock listen on all ip?
Or do you want to start WireMock with dynamic ports and listen to
http://*instead ofhttp://localhost?@josh-curtis90 commented on GitHub (Jan 18, 2018):
Yeah basically the second one. I just used PortUtil to get an available port and constructed a Url out of that port and a the host of the wiremock servers IP. Perhaps http://*:port would be more appropriate in the FluentMockServer.
Will close though as I don't think using PortUtil directly is a "bad" thing.