【问题标题】:Chrome redirects .dev to httpsChrome 将 .dev 重定向到 https
【发布时间】:2018-05-25 21:11:22
【问题描述】:

Google Chrome 突然将我的虚拟主机域 myapplication.dev 重定向到 https://myapplication.dev。我已经尝试过去

chrome://net-internals/#hsts

然后在“删除域安全策略”最底部的文本框中输入 myapplication.dev,但这没有任何效果。

我也尝试删除浏览器数据。

我也将 v-host 更改为 .app 而不是 .dev 但 Chrome 仍将我重定向到 https:// ...

这是一个运行在 Laragon 上的 Laravel 应用程序。 在同一网络中的其他电脑上,它可以完美运行。

【问题讨论】:

  • 对于使用 Valet 的 mac 用户,您可以通过 valet secure projectname 开始使用安全连接,从而使其能够与 chrome 一起使用。
  • 这也是机器叫dev的问题,http://dev/demo

标签: laravel google-chrome ssl https laragon


【解决方案1】:

检查那个链接

https://laravel-news.com/chrome-63-now-forces-dev-domains-https

根据 Danny Wahl 的这篇文章,他建议您使用以下之一:“.localhost”、“.invalid”、“.test”或“.example”。

【讨论】:

    【解决方案2】:

    没有办法阻止 Chrome (>= 63) 在 .dev 域名上使用 https。
    Google 现在拥有官方的.dev tld,并且已经声明他们不会删除此功能。

    建议使用另一个 tld 用于开发目的,例如 .localhost.test

    有关此更新的更多信息,请访问this article by Mattias Geniar

    【讨论】:

    • 如果您能提供一个可以深入了解它的链接,那就太好了。
    • 谷歌在所谓的互联网上拥有这个顶级域名,现在他们表现得好像你在所有网络上都占了上风。并与那些 www DNS 约定没有合法性的地方搞混。
    • 你好 Firefox,我的老朋友。
    • 但是!如果您使用的本地服务器实际上不在 localhost IP 地址上(例如,我使用 hostsupdater 插件将 Vagrant 机器设置为 something.localhost),请不要使用 .localhost Chrome also redirects that to the loopback address regardless of your DNS settings
    • Firefox 现在也为 .dev 域执行此操作,所以我想和那个老朋友说再见吧:-)
    【解决方案3】:

    Chrome 63 通过预加载的 HSTS 强制 .dev 域使用 HTTPS 很快所有其他浏览器都会跟进。

    .dev gTLD 已被 Google 购买供内部使用,不能再与 http 一起使用,只允许使用 https。更多解释请看这篇文章:

    https://ma.ttias.be/chrome-force-dev-domains-https-via-preloaded-hsts/

    【讨论】:

      【解决方案4】:

      MacOS Sierra、Apache:在 Chrome 63 强制 .dev 顶级域通过我的 mac 上的预加载 HSTS phpmyadmin 使用 HTTPS 后停止工作。我阅读了this 并编辑了/etc/apache2/extra/http-vhosts.conf 文件:

      <VirtualHost *:80>
        DocumentRoot "/Users/.../phpMyAdmin-x.y.z"
        ServerName phpmyadmin.localhost
      </VirtualHost>
      

      并重新启动 apache(通过 sudo /usr/sbin/apachectl stop; sudo /usr/sbin/apachectl start ) - 现在它可以在 http://phpmyadmin.localhost 上运行 :) 。对于 laravel 应用解决方案类似。

      好处是在设置新项目时使用*.localhost 顶级域可以忘记编辑/etc/hosts

      这有多酷? :)

      add the .localhost domain as a new standard还有一个很好的建议,在这里更合适。

      2018 年更新

      使用*.localhost 不好 - 一些应用程序不支持它,例如 cURL(由 php-guzzle 使用) - 更多细节 here。最好使用*.local

      【讨论】:

        【解决方案5】:

        可能值得注意的是,还有其他 TLD 被强制 https:https://chromium.googlesource.com/chromium/src.git/+/63.0.3239.118/net/http/transport_security_state_static.json#262

        googledevfoopageappchrome 现在。

        【讨论】:

          【解决方案6】:

          这个问题无法解决。原因如下:

          1. Google 拥有 .dev gTLD
          2. Chrome 直接在源代码中强制 .dev 域上的 HTTP 到 HTTPS。

          从下面的第二个链接:

          ...
          // eTLDs
          // At the moment, this only includes Google-owned gTLDs,
          // but other gTLDs and eTLDs are welcome to preload if they are interested.
          { "name": "google", "include_subdomains": true, "mode": "force-https", "pins": "google" },
          { "name": "dev", "include_subdomains": true, "mode": "force-https" },
          { "name": "foo", "include_subdomains": true, "mode": "force-https" },
          { "name": "page", "include_subdomains": true, "mode": "force-https" },
          { "name": "app", "include_subdomains": true, "mode": "force-https" },
          { "name": "chrome", "include_subdomains": true, "mode": "force-https" },
          ...
          

          参考文献

          【讨论】:

            【解决方案7】:

            对于火狐: 您可以通过访问以下地址禁用 network.stricttransportsecurity.preloadlist 属性:about:config

            对于 IE,它似乎仍在工作。

            对于 Chrome,没有解决方案,我认为它在源代码中是硬编码的。

            查看那篇文章:How to prevent Firefox and Chrome from forcing dev and foo domains to use https

            【讨论】:

              猜你喜欢
              • 1970-01-01
              • 1970-01-01
              • 2020-09-11
              • 2017-04-02
              • 2016-09-24
              • 1970-01-01
              • 2018-05-23
              相关资源
              最近更新 更多