2017-04-24 130 views
2

我已經設置了nginx的爲HTTP流量重定向到HTTPS是這樣的:瞭解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 我被系統提示正確的網址:

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

到目前爲止好。 但我想知道當我輸入密碼時會發生什麼。是否 受保護,就好像我直接連接到https://git.mydomain.it或者它是否首先通過明文傳輸到HTTP終點然後重定向?

+0

在這裏找到我的答案http://stackoverflow.com/questions/40957699/does-http-redirect-to-https-risk-capture-of-password – Oz123

+0

我不認爲這會回答你的問題,但你知道這個問題比我好。 ;) –

回答

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" 

我希望捲曲只跟隨重定向(via -L),這在本質上意味着,您的密碼獲取確實轉化通過HTTP簡單。

+0

這並不能解釋發生在我的git客戶端和git服務器之間的實際通信。密碼是如何傳輸的? – Oz123

+0

我還是不明白你的意思。這是關於HTTP的一般問題嗎?也許這會幫助你:https://git-scm.com/book/en/v2/Git-Internals-Transfer-Protocols –

+0

我使用HTTP進行連接。因此,連接從A-> B(其中A是我的計算機)到B(服務器),然後將B重定向到C.所以問題是我的密碼發生了什麼。它被髮送到A到B還是從A到C? – Oz123