ratatosk
ratatosk

Reputation: 393

How to access ionic serve -address

The ionic CLI gives the option to serve the app via

ionic serve -address=my.backend.server.com

How can I access the address given through this command in the project?

Upvotes: 3

Views: 10035

Answers (2)

Ahmed Nabil
Ahmed Nabil

Reputation: 18996

If you need to host dev server on all network interfaces (i.e. --host=0.0.0.0), you can use

ionic serve --external

Then you will have the ability to access you application by navigating to any network interfaces IP (check ipconfig command)

http://192.168.1.68:8100/
...

If you need to host on custom address, please note that CUSTOM_ADDRESS_IP should be an available IP which is assigned to your actual device

ionic serve --address CUSTOM_ADDRESS_IP

Reference
https://ionicframework.com/docs/cli/commands/serve#option-external

Upvotes: 8

matyas
matyas

Reputation: 2796

If you want to serve the application on your server and not on your local machine and reach the application through the public internet you could do the following:

ionic serve -address=0.0.0.0:8080

Then you should be able to reach the application on:

youripaddress:8080

if the dns zone entry file of your domain points to your server's ip adress you should also be able to reach your application through your domain:

yourdomain.com:8080

Also make sure that the firewall on your server accepts traffic to the port that the application is running on (in this example 8080)

Upvotes: 1

Related Questions