Skip to content

MessageProvider listening on localhost returns 404 #544

@scrocquesel-ml150

Description

@scrocquesel-ml150

Version information:

  • OS: WSL with Windows x64
  • PactNet Version: 5.0.1
  • .Net Version: 8.0

Describe the bug
I'm trying to verify message interaction for a producer. The sample project in this repo works fine, but with my project, when pact tries to request http://localhost:41952/pact-messages/, it receive a 404 response without going through the HandleRequest method of MessageProvider.

If I modify the prefix uri with 127.0.0.1, then it works in all cases.

What is important is that the Uri added to the HttpListener must be 127.0.0.1. Then, the returned uri can be the ip or localhost it works in both cases.

I know it is connecting to the listener somehow because if I comment out the start of the HttpListener, then it cannot connect.

There is definetely something going in the middle with localhost but I can't figure it out.

Steps To Reproduce
I didn't succeed yet identifying what's going on.

Expected behavior
The listener should be able to receive pact_verifier request

Log Output

2025-06-20T13:58:12.662599Z DEBUG ThreadId(01) verify_interaction{interaction="A valid message"}: reqwest::connect: starting new connection: http://127.0.0.1:49152/    
2025-06-20T13:58:12.662613Z DEBUG ThreadId(01) verify_interaction{interaction="A valid message"}: hyper_util::client::legacy::connect::http: connecting to 127.0.0.1:49152
2025-06-20T13:58:12.662888Z DEBUG ThreadId(01) verify_interaction{interaction="A valid message"}: hyper_util::client::legacy::connect::http: connected to 127.0.0.1:49152
2025-06-20T13:58:12.691760Z DEBUG ThreadId(01) verify_interaction{interaction="A valid message"}: hyper_util::client::legacy::pool: pooling idle connection for ("http", 127.0.0.1:49152)
2025-06-20T13:58:12.691815Z DEBUG ThreadId(01) verify_interaction{interaction="A valid message"}: pact_verifier::provider_client: Received native response: Response { url: "http://127.0.0.1:49152/pact-messages", status: 404, headers: {"content-type": "text/html", "server": "Microsoft-NetCore/2.0", "date": "Fri, 20 Jun 2025 13:58:12 GMT", "content-length": "30"} }
2025-06-20T13:58:12.691945Z  INFO ThreadId(01) verify_interaction{interaction="A valid message"}: pact_verifier::provider_client: Received response: HTTP Response ( status: 404, headers: Some({"content-type": ["text/html"], "server": ["Microsoft-NetCore/2.0"], "date": ["Fri, 20 Jun 2025 13:58:12 GMT"], "content-length": ["30"]}), body: Present(30 bytes, text/html) )
2025-06-20T13:58:12.691967Z DEBUG ThreadId(01) verify_interaction{interaction="A valid message"}: pact_verifier::provider_client: body:
<h1>Not Found (Not Found)</h1>

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behaviortriageThis issue is yet to be triaged by a maintainer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions