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

fix: usage 0.0.0.0 instead of localhost by default in .env.example #6

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

theoludwig
Copy link

By default, when creating an Adonis app, we can't access the running application using 127.0.0.1 which is unexpected.
While someone can easily find out, it is because the .env is misconfigured, and should set HOST=0.0.0.0 it can still be quite cumbersome to understand and find out why it is not working.

This PR, change the default provided in .env.example.
If you accept this PR, I will be able to open similar PRs for the other starter kits: https://github.com/adonisjs/web-starter-kit and https://github.com/adonisjs/slim-starter-kit

@RomainLanz
Copy link
Member

RomainLanz commented Aug 8, 2024

By default, when creating an Adonis app, we can't access the running application using 127.0.0.1

We can access it through 127.0.0.1 or localhost.

0.0.0.0 means it should listen on all interfaces. It is useful for specific use cases, like those inside a Docker container or when you are trying to access your application from another device inside your network.

@theoludwig
Copy link
Author

I verified again to be sure 100%, with HOST=localhost:
image

With HOST=0.0.0.0:
image

0.0.0.0 means it should listen on all interfaces. It is useful for specific use cases, like those inside a Docker container or when you are trying to access your application from another device inside your network.

Yes, it is useful in many cases, so why not use it by default?
Are there any drawback of doing so, other than now, the application is accessible on the whole network, with the local ip address like for example: 192.168.1.56:3333.

You are also using HOST=0.0.0.0 for https://github.com/adonisjs/adonisjs.com/blob/main/.env.example.

@theoludwig
Copy link
Author

Should this PR be closed as unlikely to be merged? @RomainLanz

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

Successfully merging this pull request may close these issues.

2 participants