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

查看:634
本文介绍了为什么我可以直接访问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所述,如果您尝试从本地网络上的其他计算机(例如,智能手机,平板电脑,虚拟机中的其他OS等)访问应用程序,则此方法可以正常工作.

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天全站免登陆