Skip to content

Commit

Permalink
Merge pull request #2207 from murgatroid99/grpc-js-xds_default_author…
Browse files Browse the repository at this point in the history
…ity_virtualhost

grpc-js-xds: Use authority override to select VirtualHost when provided
  • Loading branch information
murgatroid99 committed Aug 25, 2022
2 parents fcf63ee + 2c6fd77 commit a56e0fc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/grpc-js-xds/src/resolver-xds.ts
Expand Up @@ -319,9 +319,12 @@ class XdsResolver implements Resolver {
private handleRouteConfig(routeConfig: RouteConfiguration__Output, isV2: boolean) {
this.latestRouteConfig = routeConfig;
this.latestRouteConfigIsV2 = isV2;
const virtualHost = findVirtualHostForDomain(routeConfig.virtual_hosts, this.target.path);
/* Select the virtual host using the default authority override if it
* exists, and the channel target otherwise. */
const hostDomain = this.channelOptions['grpc.default_authority'] ?? this.target.path;
const virtualHost = findVirtualHostForDomain(routeConfig.virtual_hosts, hostDomain);
if (virtualHost === null) {
this.reportResolutionError('No matching route found');
this.reportResolutionError('No matching route found for ' + hostDomain);
return;
}
const virtualHostHttpFilterOverrides = new Map<string, HttpFilterConfig>();
Expand Down

0 comments on commit a56e0fc

Please sign in to comment.