Skip to content

Bug Accessing Localhost with Node.js >= 17 #31

@chsami

Description

@chsami

Description:
There's a current issue with Node.js versions 17 and above where using localhost in URLs for HTTP requests results in failure, whereas using 127.0.0.1 works as expected. This issue is documented and tracked in the Node.js GitHub repository (nodejs/node#40702).

Problem Statement:
Due to this issue, accessing endpoints like http://localhost:11434/api/generate in Node.js >= 17 fails to resolve properly.

Solution (Temporary Fix):
A temporary fix is to replace localhost with 127.0.0.1 in the URL to ensure proper resolution. For example:

http://127.0.0.1:11434/api/generate

Proposed Improvement:
It would be beneficial to have the ability to specify the endpoint URL through command-line arguments or configuration settings until the underlying issue in Node.js is resolved. This would allow users to easily adapt to this change without modifying the code.

Request:
Could a change be implemented to allow users to specify their own endpoint URLs through arguments or configuration settings? Alternatively, consider updating the code to replace localhost with 127.0.0.1 internally until the Node.js issue is resolved.

Additional Context:
I've implemented a local fix in my repository, but having this addressed at the project level would greatly benefit other users encountering the same issue.

Thanks!

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions