Skip to content

Commit a21b521

Browse files
authored
Set grpc :authority header from request header (#8912)
This is to fix that the `:authority` header is set to `upstream_balancer`
1 parent 643c475 commit a21b521

File tree

2 files changed

+1
-2
lines changed

2 files changed

+1
-2
lines changed

rootfs/etc/nginx/template/nginx.tmpl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1388,13 +1388,11 @@ stream {
13881388
{{ end }}
13891389

13901390
{{/* By default use vhost as Host to upstream, but allow overrides */}}
1391-
{{ if not (eq $proxySetHeader "grpc_set_header") }}
13921391
{{ if not (empty $location.UpstreamVhost) }}
13931392
{{ $proxySetHeader }} Host {{ $location.UpstreamVhost | quote }};
13941393
{{ else }}
13951394
{{ $proxySetHeader }} Host $best_http_host;
13961395
{{ end }}
1397-
{{ end }}
13981396

13991397
# Pass the extracted client certificate to the backend
14001398
{{ if not (empty $server.CertificateAuth.CAFileName) }}

test/e2e/annotations/grpc.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ var _ = framework.DescribeAnnotation("backend-protocol - GRPC", func() {
120120

121121
metadata := res.GetMetadata()
122122
assert.Equal(ginkgo.GinkgoT(), metadata["content-type"].Values[0], "application/grpc")
123+
assert.Equal(ginkgo.GinkgoT(), metadata[":authority"].Values[0], host)
123124
})
124125

125126
ginkgo.It("authorization metadata should be overwritten by external auth response headers", func() {

0 commit comments

Comments
 (0)