【问题标题】:Understanding NGINX HTTP to HTTPS redirect了解 NGINX HTTP 到 HTTPS 重定向
【发布时间】:2017-09-20 19:09:21
【问题描述】:

我已设置 nginx 以将 HTTP 流量重定向到 HTTPS,如下所示:

server {

    listen 80;
    server_name git.mydomain.it;

    return 301 https://$host$request_uri;  

}

我可以通过 HTTPS 和 HTTP 成功连接。

当我做git clone http://git.mydomain.it/oznt/tracker.git 系统提示我输入正确的 URL:

 $ git clone http://git.mydomain.it/oznt/tracker.git
Cloning into 'tracker'...
Username for 'https://git.mydomain.it': 

到目前为止一切顺利。 但我想知道当我输入密码时会发生什么。是不是正在 就像我直接连接到 https://git.mydomain.it 一样受到保护,还是它首先以明文形式通过网络传输到 HTTP 端点,然后被重定向?

【问题讨论】:

标签: git redirect nginx https


【解决方案1】:

它应该是 https,您可以通过查看本地 .git 文件夹中的 config 文件来检查它。注意:

[remote "origin"]
  url = https://foo.bar.git

编辑:正如它所写的in the source code

http_fetch () {
  # $1 = Remote, $2 = Local
  curl -nsfL $curl_extra_args "$1" >"$2"

我希望 curl 只遵循重定向 (via -L),这实质上意味着您的密码确实通过 HTTP 以纯格式转换。

【讨论】:

  • 这并不能解释我的 git 客户端和 git 服务器之间发生的实际通信。密码是如何传输的?
  • 我还是不明白你的意思。这是关于 HTTP 的一般问题吗?也许这会对你有所帮助:git-scm.com/book/en/v2/Git-Internals-Transfer-Protocols
  • 我使用 HTTP 连接。因此,连接从 A->B(其中 A 是我的计算机)到 B(服务器),然后将 B 重定向到 C。所以问题是我的密码发生了什么。是从 A 发送到 B 还是从 A 发送到 C ?
  • 我编辑了我的答案,希望它能回答你的问题。 ;)
  • 我从您的回答中了解到上面的链接。无论如何,我的 git 现在不再监听纯 HTTP。
猜你喜欢
  • 2011-03-29
  • 2018-01-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-10-11
  • 2017-05-25
  • 2018-08-18
相关资源
最近更新 更多