Skip to content
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

WireMock not working when attempting to access from anything other than localhost. #78

Closed
Curtis004 opened this issue Jan 17, 2018 · 4 comments

Comments

@Curtis004
Copy link

Curtis004 commented 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 https://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

@Curtis004
Copy link
Author

Curtis004 commented 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.

@Curtis004 Curtis004 reopened this Jan 17, 2018
@Curtis004
Copy link
Author

Curtis004 commented 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
Copy link
Collaborator

StefH commented Jan 17, 2018

You could use 'https://*:80' for an url? Which makes WireMock listen on all ip?

Or do you want to start WireMock with dynamic ports and listen to https://* instead of https://localhost ?

@Curtis004
Copy link
Author

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 https://*:port would be more appropriate in the FluentMockServer.

Will close though as I don't think using PortUtil directly is a "bad" thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants