使用 lvh.me 而不是 localhost 进行测试是否安全? [英] It is safe to use lvh.me instead of localhost for testing?

查看:39
本文介绍了使用 lvh.me 而不是 localhost 进行测试是否安全?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道在本地开发时使用 lvh.me 而不是 localhost 是否安全,因为必须解析 lvh.me 并且IP 可能会随着时间而改变.

I wonder whether is safe to use lvh.me instead of localhost when developing locally, since lvh.me must be resolved and the IP may change over time.

使用 lvh.me 的目标是能够处理子域,因为 localhost 没有顶级域.

The goal of using lvh.me is to be able to handle subdomains, since localhost does not have top level domain.

推荐答案

除非您是 lvh.me 的维护者,否则您无法确定它不会消失或更改 lvh.me 的 RR.

Unless you are the maintainer of lvh.me, you can not be sure it will not disappear or change its RRs for lvh.me.

您可以使用 localhost.localdomain 而不是 localhost,方法是在 hosts 文件中添加以下几行:

You can use localhost.localdomain instead of localhost, by adding the following lines in your hosts file:

127.0.0.1 localhost localhost.localdomain
::1 localhost localhost.localdomain

这比使用 lvh.me 更好,因为:

This is better than using lvh.me because:

  • 在开发过程中,您可能无法始终访问 DNS 解析器
  • lvm.me 不使用与您的本地主机相对应的本地 IPv6 地址,仅使用 IPv4 地址 127.0.0.1
  • 出于安全目的(避免泄露内部信息),某些 ISP 的 DNS 解析器会阻止与私有地址空间相对应的答案

由于您在评论中表示不想更新主机文件,因此您无法确定 lvh.me 将始终为您的开发人员工作.因此,回答您的问题:这是不安全的.您可以为自己注册一个域,但正如我之前所说,一些解析器会阻止对应于私有地址空间的答案.

Since you said in a comment that you do not want to update the host file, you have no mean to be sure that lvh.me will always work for your developers. Therefore, to answer your question: it is not safe. You may register a domain for yourself, but as I said before, some resolvers will block answers corresponding to private addresses space.

这篇关于使用 lvh.me 而不是 localhost 进行测试是否安全?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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