请求用indress.kubernetes.io/auth-url注释定义URL



我正在使用auth-url和auth-signin注释来验证对应用程序的访问。问题是,使用auth-url定义的URL请求始终使用HTTP/1.0来完成,而不是按预期使用HTTP/1.1。从日志中,您可以看到所有其他请求均使用http/1.1。

使用的版本:nginx-ingress-controller:0.9.0-beta.19

来自ELB的日志:

2017-11-30T14:28:30.606436Z dev-sandbox-2cb4 201.137.96.59:58692 10.10.0.101:80 0.000044 0.031215 0.000039 302 302 0 154 "GET https://example.net:443/testing/ HTTP/1.1" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36" ECDHE-RSA-AES128-GCM-SHA256 TLSv1.2
2017-11-30T14:28:30.623944Z dev-sandbox-2cb4 24.134.104.23:40704 10.10.7.144:80 0.000029 0.01263 0.000068 401 401 0 21 "GET https://example.net:443/oauth2/auth HTTP/1.0" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36" ECDHE-RSA-AES128-GCM-SHA256 TLSv1.2
2017-11-30T14:28:30.699239Z dev-sandbox-2cb4 201.137.96.59:58692 10.10.3.6:80 0.000028 0.001223 0.000046 302 302 0 395 "GET https://example.net:443/oauth2/start?rd=https://example.net/testing/ HTTP/1.1" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36" ECDHE-RSA-AES128-GCM-SHA256 TLSv1.2

注释:

  annotations:
    ingress.kubernetes.io/auth-url: "https://$host/oauth2/auth"
    ingress.kubernetes.io/auth-signin: "https://$host/oauth2/start"

问题是,在环境中,我只允许使用1.1。

这是可以期待的还是我做错了什么?

可以通过添加

来解决问题
proxy_http_version          1.1;

在nginx Ingress模板中的location = {{ $authPath }}块下。

请参阅https://github.com/kubernetes/ingress-nginx/pull/1787。

最新更新