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

Localhost connects on IPv6 only - refuses IPv4 #13052

Closed
1 task done
mattjohnsonpint opened this issue Aug 4, 2024 · 8 comments
Closed
1 task done

Localhost connects on IPv6 only - refuses IPv4 #13052

mattjohnsonpint opened this issue Aug 4, 2024 · 8 comments
Assignees
Labels
product/api-client protocol/graphql Issues relating to the GraphQL protocol within Postman protocol/http Issues related to using the HTTP protocol within Postman

Comments

@mattjohnsonpint
Copy link

mattjohnsonpint commented Aug 4, 2024

Is there an existing issue for this?

  • I have searched the tracker for existing similar issues and I know that duplicates will be closed

Describe the Issue

After updating to 11.6.2, I started getting failures connecting to localhost. It turns out my app is serving on 127.0.0.1 (IPv4) and Postman is only trying [::1] (IPv6).

It used to connect without issue, which according to this is the correct behavior. But now it fails.

Steps To Reproduce

Make an app that listens on localhost on IPv4 only. Try to connect to it. Get failure.

Any request type fails. Mine happened to be GraphQL, but that's not relevant as others fail also.

Screenshots or Videos

image

Operating System

macOS

Postman Version

11.6.2

Postman Platform

Postman App

User Account Type

Signed In User

Additional Context?

No response

@codenirvana codenirvana added protocol/graphql Issues relating to the GraphQL protocol within Postman product/api-client labels Aug 5, 2024
@mattjohnsonpint
Copy link
Author

@codenirvana protocol/http would be most appropriate. As I mentioned, it's not related to GraphQL. A standard HTTP query to localhost has the same behavior.

@codenirvana codenirvana added the protocol/http Issues related to using the HTTP protocol within Postman label Aug 5, 2024
@Dr-Obek
Copy link

Dr-Obek commented Aug 5, 2024

It's more general. Since the mentioned version, Postman started translating localhost to [::1] only. I encountered this when my Postman connection stopped working via the cntlm proxy running at 127.0.0.1:3128. It can be resolved by changing all 'localhost' to '127.0.01', but it's quite annoying. Could you please address that?

@lsiebels
Copy link

lsiebels commented Aug 5, 2024

In my case, even using 127.0.0.1 instead of localhost does not work properly and in one case I still get the error message Error: connect ECONNREFUSED ::1:443.

@matthaddon
Copy link

Same issue since the update - still happening with v11.7

http://localhost:4000
Details: connect ECONNREFUSED ::1:4000

http://127.0.01:4000 works, but its an annoying workaround.

@parthverma1
Copy link

Hi @matthaddon,
I was able to reproduce the error for GraphQL, but not for HTTP requests. It would be useful if you could share a screen recording and/or more details steps of reproduction that could help us reproduce this locally.
I will update this thread once a fix is released and available. Until then, you should be able to get around this issue by using 127.0.0.1 instead of localhost.

@mattjohnsonpint
Copy link
Author

FWIW, I just rewrote part of my app so that it listens on both 127.0.0.1 and [::1] if IPv6 is enabled. A bit tricky to implement (in Go with graceful shutdown of multiple listeners), but probably a more robust solution for our users in the long run. May be easier on other platforms. It should still be fixed in Postman so this isn't necessary though.

@Floppy012
Copy link

Another workaround if a hostname is required (e.g. DDEV):

Change the URL of requests to https://127.0.0.1 and add a pre-request script to your collection:

pm.request.removeHeader('Host');
pm.request.addHeader({
    key: 'Host',
    value: 'xyz.ddev.site',
});

However, this does not seem to work for the Authorization process (I'm using OAuth2). To have this working I had to keep the ddev.site url for the "Auth URL" but replace everything else with 127.0.0.1 and then set the Host header at the bottom of the Authorization configuration:
CleanShot 2024-08-07 at 05 24 57@2x

@parthverma1 parthverma1 self-assigned this Aug 10, 2024
@parthverma1
Copy link

Hi @mattjohnsonpint
This was fixed with version 11.8 of the app. I am closing this issue for now. Feel free to re-open the issue if the problem recurs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
product/api-client protocol/graphql Issues relating to the GraphQL protocol within Postman protocol/http Issues related to using the HTTP protocol within Postman
Projects
None yet
Development

No branches or pull requests

7 participants