为什么可以直接访问IP时需要xip io? [英] Why is xip io needed when I can access the IP directly?

查看:47
本文介绍了为什么可以直接访问IP时需要xip io?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

xip.io 欢迎屏幕显示:

xip.io welcome screens says this :

10.0.0.1.xip.io 解析为 10.0.0.1

10.0.0.1.xip.io resolves to 10.0.0.1

可以直接使用IP,为什么还要通过xip io?

Why do we need to go through xip io when I can directly use the IP?

是不是通过域名访问服务器,而不是通过IP访问服务器?

Is it used to access servers by domain name instead of IP?

推荐答案

主要用例是当您的应用程序需要支持多个子域时.

The main use case is when your application needs to support multiple subdomains.

以这些生产子域为例:

  • www.example.com
  • admin.example.com
  • members.example.com

或者您可以考虑一个多租户应用程序,其中每个帐户都有自己的自定义子域:

Or you can consider a multi-tenant application where each account gets its own custom subdomain:

  • mycompany.example.com
  • anotherguy.example.com

因此,设置生产环境来满足此请求很容易.

So it's easy enough to setup a production environment to serve this requests.

但是如果您的开发环境没有像 xip.io 这样的服务,您就无法在 IP 地址前放置子域来适当地路由您的请求.

But without a service like xip.io for your development environment, you cannot put a subdomain in front of an IP address to route your request appropriately.

为了解决这个问题,您可以通过 xip.io 的子域访问您的应用程序:

To get around this, you can access your application through a subdomain like this through xip.io:

http://mycompany.10.0.0.1.xip.io/

正如 xip.io 所述,如果您尝试从本地网络上的其他机器访问应用程序,无论是智能手机、平板电脑还是虚拟机中的其他操作系统等,这都可以完美运行.

As xip.io states, this then works flawlessly if you're trying to access the application from other machines on your local network, be they smartphones, tablets, other OSes within VMs, etc.

这篇关于为什么可以直接访问IP时需要xip io?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆