2017-02-06 12 views
0

HTTPトラフィックとHTTPSのリダイレクト(1)と(2)自己署名付きGitlab-Omnibusインスタンス用にバンドルされていないnginxサーバーを設定しています証明書。nginxプロキシで '/'を使用したループリダイレクトGitlab CE in Omnibusパッケージ

私は、ルートの場所でループリダイレクトを永久に取得しています。ここで

はカールが書き込みです:

F:\tmp>curl.exe -I -L https://localsite.example.com 
HTTP/1.1 302 Found 
Server: nginx/1.10.2 
Date: Mon, 06 Feb 2017 14:47:49 GMT 
Content-Type: text/html; charset=utf-8 
Connection: keep-alive 
Cache-Control: no-cache 
Location: http://localsite.example.com 
X-Content-Type-Options: nosniff 
X-Frame-Options: SAMEORIGIN 
X-Request-Id: 889bcd5a-0646-46c1-902a-e569833a3b0d 
X-Runtime: 0.032797 
X-Xss-Protection: 1; mode=block 

HTTP/1.1 301 Moved Permanently 
Server: nginx 
Date: Mon, 06 Feb 2017 14:47:49 GMT 
Content-Type: text/html 
Content-Length: 178 
Connection: keep-alive 
Location: https://localsite.example.com/ 

HTTP/1.1 302 Found 
Server: nginx/1.10.2 
Date: Mon, 06 Feb 2017 14:47:49 GMT 
Content-Type: text/html; charset=utf-8 
Connection: keep-alive 
Cache-Control: no-cache 
Location: http://localsite.example.com 
X-Content-Type-Options: nosniff 
X-Frame-Options: SAMEORIGIN 
X-Request-Id: 9be22e5f-07f3-4381-a161-109960cb5338 
X-Runtime: 0.039810 
X-Xss-Protection: 1; mode=block 

HTTP/1.1 301 Moved Permanently 
Server: nginx 
Date: Mon, 06 Feb 2017 14:47:49 GMT 
Content-Type: text/html 
Content-Length: 178 
Connection: keep-alive 
Location: https://localsite.example.com/ 

HTTP/1.1 302 Found 
Server: nginx/1.10.2 
Date: Mon, 06 Feb 2017 14:47:49 GMT 
Content-Type: text/html; charset=utf-8 
Connection: keep-alive 
Cache-Control: no-cache 
Location: http://localsite.example.com 
X-Content-Type-Options: nosniff 
X-Frame-Options: SAMEORIGIN 
X-Request-Id: 14f4de36-d327-467a-b3c2-716f11ec5499 
X-Runtime: 0.059843 
X-Xss-Protection: 1; mode=block 
.... 

curl: (47) Maximum (50) redirects followed 

は私がhereからレシピを撮影したし、ここに私のnginx.confの関連する部分である

upstream gitlab-workhorse { 
    server unix:/var/opt/gitlab/gitlab-workhorse/socket fail_timeout=0; 
} 

server { 
    listen 0.0.0.0:80; 
    server_name localsite.example.com; 
    server_tokens off; ## Don't show the nginx version number, a security best practice 
    return 301 https://$http_host$request_uri; 
} 

server { 
    listen 443 ssl default; 
    server_name localsite.example.com; 
    ssl on; 

    ssl_certificate /etc/gitlab/ssl/localsite.example.com.crt; 
    ssl_certificate_key /etc/gitlab/ssl/localsite.example.com.key; 

    ssl_ciphers "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4"; 
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2; 
    ssl_prefer_server_ciphers on; 
    ssl_session_cache shared:SSL:10m; 
    ssl_session_timeout 5m; 

    root /opt/gitlab/embedded/service/gitlab-rails/public; 

    location/{ 
     root /opt/gitlab/embedded/service/gitlab-rails/public; 
     client_max_body_size 0; 
     gzip off; 

     ## https://github.com/gitlabhq/gitlabhq/issues/694 
     ## Some requests take more than 30 seconds. 
     proxy_read_timeout  300; 
     proxy_connect_timeout 300; 
     proxy_redirect  off; 

     proxy_http_version 1.1; 

     proxy_set_header Host    $http_host; 
     proxy_set_header X-Real-IP   $remote_addr; 
     proxy_set_header X-Forwarded-Ssl  on; 
     proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for; 
     proxy_set_header X-Forwarded-Proto https; 

     proxy_pass   http://gitlab-workhorse; 
    } 
} 

のUbuntu 14.04、nginxの1.10.2 PPAからインストールします。

他の場所はループリダイレクトを受信しません。たとえば、curl.exe -I -L http://localsite.example.com/publicは301、次に200を返します。

だから間違っていますか?

更新コメント

を読んだ後、はい、これはLocation: http://localsite.example.comを返しgitlab-働き者です。 docsによると、httpsを実行することはできません。 これは私がデバッグ

2017/02/07 11:30:41 [debug] 31020#31020: *26471 http proxy header: "User-Agent: curl/7.49.0" 
2017/02/07 11:30:41 [debug] 31020#31020: *26471 http proxy header: "Accept: */*" 
2017/02/07 11:30:41 [debug] 31020#31020: *26471 http proxy header: 
"HEAD/HTTP/1.1 
Host: localsite.example.com 
X-Real-IP: 192.168.129.34 
X-Forwarded-Ssl: on 
X-Forwarded-For: 192.168.129.34 
X-Forwarded-Proto: https 
Connection: close 
User-Agent: curl/7.49.0 
Accept: */* 

" 
2017/02/07 11:30:41 [debug] 31020#31020: *26471 connect to unix:/var/opt/gitlab/gitlab-workhorse/socket, fd:16 #26472 
2017/02/07 11:30:41 [debug] 31020#31020: *26471 connected 
2017/02/07 11:30:41 [debug] 31020#31020: *26471 http upstream connect: 0 

2017/02/07 11:30:41 [debug] 31020#31020: *26471 http proxy status 302 "302 Found" 
2017/02/07 11:30:41 [debug] 31020#31020: *26471 http proxy header: "Cache-Control: no-cache" 
2017/02/07 11:30:41 [debug] 31020#31020: *26471 http proxy header: "Content-Type: text/html; charset=utf-8" 
2017/02/07 11:30:41 [debug] 31020#31020: *26471 http proxy header: "Date: Tue, 07 Feb 2017 08:30:41 GMT" 
2017/02/07 11:30:41 [debug] 31020#31020: *26471 http proxy header: "Location: http://localsite.example.com" 
2017/02/07 11:30:41 [debug] 31020#31020: *26471 http proxy header: "X-Content-Type-Options: nosniff" 
2017/02/07 11:30:41 [debug] 31020#31020: *26471 http proxy header: "X-Frame-Options: SAMEORIGIN" 
2017/02/07 11:30:41 [debug] 31020#31020: *26471 http proxy header: "X-Request-Id: 69b0b688-bdfb-4be5-ae66-d2ddc71c2f96" 
2017/02/07 11:30:41 [debug] 31020#31020: *26471 http proxy header: "X-Runtime: 0.027523" 
2017/02/07 11:30:41 [debug] 31020#31020: *26471 http proxy header: "X-Xss-Protection: 1; mode=block" 
2017/02/07 11:30:41 [debug] 31020#31020: *26471 http proxy header: "Connection: close" 
2017/02/07 11:30:41 [debug] 31020#31020: *26471 http proxy header done 
2017/02/07 11:30:41 [debug] 31020#31020: *26471 posix_memalign: 00007F4038B03F30:4096 @16 
2017/02/07 11:30:41 [debug] 31020#31020: *26471 HTTP/1.1 302 Found 
Server: nginx 
Date: Tue, 07 Feb 2017 08:30:41 GMT 
Content-Type: text/html; charset=utf-8 
Connection: keep-alive 
Cache-Control: no-cache 
Location: http://localsite.example.com 
X-Content-Type-Options: nosniff 
X-Frame-Options: SAMEORIGIN 
X-Request-Id: 69b0b688-bdfb-4be5-ae66-d2ddc71c2f96 
X-Runtime: 0.027523 
X-Xss-Protection: 1; mode=block 

アップデート2を有効にした後、ログに持っているものです。これはGitlabのバグのようです。私はNGINXをオフにしてバンドルされたものを有効にしようとしましたが、同じリダイレクトループを持っています。

+0

proxy_redirect off; 

を交換する必要があります。それはあなたのアップストリームサーバーかもしれません。上記のコードスニペットでは、これを行うことはできませんでした。 –

答えて

0

更なる更新が回帰をもたらしました。バージョン9.0.5、バグがあります。

ただし、これはNginxのproxy_redirectディレクティブで修正できます。 > HTTP -

一つは、何かがhttpsにリダイレクトされるように見えます

proxy_redirect http://localsite.example.com https://localsite.example.com/users/sign_in; 
0

はい、それはGitlab Workhorseでした。

8.17にアップデートすることで問題が解決しました。

関連する問題