使用 lvh.me 而不是 localhost 进行测试是否安全?

编程入门 行业动态 更新时间:2024-10-26 20:32:51
本文介绍了使用 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 进行测试是否安全?

本文发布于:2023-07-29 11:09:46,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1240171.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:进行测试   而不是   lvh   localhost

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!