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

Show localhost in URL for IPv6 addresses #17160

Closed
wants to merge 1 commit into from

Conversation

mirkonasato
Copy link

What does it do?

Treat :: like 0.0.0.0 and ::1 like 127.0.0.1 when showing the local Strapi URL.

Why is it needed?

By default Strapi listens on 0.0.0.0 i.e. only on IPv4. This is a problem because Node v18 (current LTS) defaults to IPv6. So if you're running another Node process, say a Next.js app, that tries to connect to Strapi it will probably fail with ECONNREFUSED ::1:1337. (Probably because it depends on how exactly the network is configured on your machine.)

That's why I set HOST=:: in .env. :: the IPv6 equivalent of 0.0.0.0.

But that way Strapi shows an invalid URL in the logs, which won't work if somebody tries to open it in the browser. Either strapi develop or strapi start print:

To manage your project 🚀, go to the administration panel at:
http://:::1337/admin

To access the server ⚡️, go to:
http://:::1337

This change should make it show http://localhost:1337, like it already does for 0.0.0.0.

How to test it?

Start a Strapi app and see what URL it prints to the console.

Related issue(s)/PR(s)

#12285

@Convly Convly self-assigned this Jul 3, 2023
@Convly Convly self-requested a review July 3, 2023 09:35
@Convly Convly added source: core:strapi Source is core/strapi package pr: enhancement This PR adds or updates some part of the codebase or features labels Jul 3, 2023
@hanpaine hanpaine removed the request for review from Convly April 18, 2024 10:20
@alexandrebodin
Copy link
Member

Important

With the release of Strapi 5, we have lifted the code freeze. To ensure we can effectively review and assist with contributions, we are now only accepting PRs targeting version 5 (the develop branch).

As your PR targets version 4, it has been automatically closed. However, we would greatly appreciate it if you could update your contribution to align with version 5 and resubmit!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community pr: enhancement This PR adds or updates some part of the codebase or features source: core:strapi Source is core/strapi package
Projects
Development

Successfully merging this pull request may close these issues.

4 participants