Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GRPC: Routing rewrite upstream and GRPC one was not used. #1177

Merged
merged 1 commit into from
Mar 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).


## [Unreleased]

- Fixed naming issues in policies [THREESCALE-4150](https://issues.jboss.org/browse/THREESCALE-4150) [PR #1167](https://github.com/3scale/APIcast/pull/1167)
- Fixed issues on invalid config in logging policy [THREESCALE-4605](https://issues.jboss.org/browse/THREESCALE-4605) [PR #1168](https://github.com/3scale/APIcast/pull/1168)
- Fixed issues with routing policy and GRPC one [THREESCALE-4684](https://issues.jboss.org/browse/THREESCALE-4684) [PR #1177](https://github.com/3scale/APIcast/pull/1177)

## [3.7.0-alpha2]

Expand Down
15 changes: 14 additions & 1 deletion gateway/src/apicast/policy/grpc/grpc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,19 @@ function _M:rewrite(context)
end
end

function _M:content(context)
-- This is needed within the combination of the routing policy, if not the
-- upstream got overwritten and balancer phase is called before.
if not context.upstream_location_name then
return
end

if ngx.var.server_protocol ~= "HTTP/2.0" then
ngx.var.host = context.upstream_location_name
end

end

function _M:balancer(context)
if not context.upstream_location_name then
return
Expand All @@ -37,7 +50,7 @@ function _M:balancer(context)
local peers = balancer:peers(upstream.servers)
local peer, err = balancer:select_peer(peers)
if err then
ngx.log(ngx.WARN, "Cannot get a peer for the given upstream", err)
ngx.log(ngx.WARN, "Cannot get a peer for the given upstream: ", err)
return
end

Expand Down