Image showing How to solve can connect with localhost but not IP?

How to solve can connect with localhost but not IP?

affiliate best offer

I have hosted one of my websites on kubernetes and am happy with it … except with one thing: how I can access it. My local IP address is If I use localhost or, it works. But if I use my local IP address, I cannot access it.

Sound similar. Here is how to solve it.


You must pay attention to the interface your website is listening on. if you run the website with grunt, make sure that you use instead of localhost.


Most of the application come configured to listen on localhost only for security reasons. It avoids exposing a potentially unsecure server outside of the server it is running on. It allows the administrator to test locally the application before releasing it to the rest of the world.

My setup

I have my website installed on kubernetes. To run it, I use the command grunt serve.

The command starts my website on the port 9000.

The problem

Here are the urls that I use to access it (If my computer is connected to my home network):

  • http://localhost:9000/ : works okay.
  • : works okay too.
  • : fail to connect

If my computer is connected to other networks, all the three urls work well.

The solution

The issue is coming from the interface the application is running on. If you start the application using localhost interface it will be available on the server only. If you start the application using interface, it will be available on all the available interfaces, hence your local IP address.

To solve the issue:

  1. Stop the application
  2. Update the configuration (start the application using the
  3. Start the application using the same command as before grunt serve
  4. Connect to the application using it’s local ip address


I hope this solution will help you in your journey. Contact us if you need help.

You might also like these blog posts

Full Bright

Full Bright

A professional and sympathic business man.


Contact Us

To order one of our services, navigate to the order service page


10 rue de Penthièvre,
75008 Paris

Email Us

hello at bright-softwares dot com

Open Hours

Monday - Friday
9:00AM - 05:00PM