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

how can i change server ip to 0.0.0.0 rather than localhost #243

Closed
shyzz opened this issue Jun 10, 2021 · 5 comments
Closed

how can i change server ip to 0.0.0.0 rather than localhost #243

shyzz opened this issue Jun 10, 2021 · 5 comments

Comments

@shyzz
Copy link

shyzz commented Jun 10, 2021

because i deploy this server in my esc. when i run npm run dev ,this server run in localhost:3030。but esc dont support visit localhost in public network. please endow me a easy way to change running ip

@lmolteno
Copy link

If you run with the --remote flag, it allows access from the network.
For me, I just added a line to my package.json under scripts which was "remote": "slidev --open --remote",, which could later be run with npm run remote.

@keaising
Copy link

keaising commented Jun 19, 2021

--remote and 0.0.0.0 are not the same when host has multiple ip address.

When the host has multiple ip address, --remote will choose an ip randomly to host website and you can only access the website from the ip chosen by --remote, but 0.0.0.0 will allow you to access from all of the ip addresses.

Allow user change host ip really make sense.

@antfu
Copy link
Member

antfu commented Jun 19, 2021

--remote is just an alias to host: '0.0.0.0',

host: remote ? '0.0.0.0' : 'localhost',

when you do that, please there is an security caveat you will need to be aware of vitejs/vite#2820

We could expose the host option to specify the ip, which I could think it's quite an edge case. If you really want that, open for pr. Thanks.

@antfu antfu closed this as completed Jun 19, 2021
@thisismygitrepo
Copy link

thisismygitrepo commented Aug 27, 2024

answer not written in the most careful way,

the correct answer is npm run dev -- --remote. Without the double -- -- it doesn't work.

Cli docs is also confusing, it says remote control > pass --remote to enable

and you pass --remote and nothing changes.

@kermanx
Copy link
Member

kermanx commented Aug 27, 2024

answer not written in the most careful way,

the correct answer is npm run dev -- --remote. Without the double -- -- it doesn't work.

Cli docs is also confusing, it says remote control > pass --remote to enable

and you pass --remote and nothing changes.

FYI, the extra -- is for NPM. Directly execute the Slidev CLI or use PNPM doesn't require this.

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

No branches or pull requests

6 participants