gRPC with responder policy

The gRPC with responder policy configuration explains how a Citrix ADC appliance provides different responses to gRPC requests over HTTP/2 protocol. When users request a website home page, you might want to provide a different home page depending on where each user is located or the browser the user is using. The following diagram shows the components interact.

gRPC with responder policy

  1. Enable the responder feature on the appliance.
  2. Configure the responder action to generate a custom response, redirect a request to a different webpage, or reset a connection.
  3. Configure the responder policy for determining the gRPC requests (traffic) on which an action has to be taken.
  4. Bind the responder policy to the load balancing virtual server to examine if the traffic matches the policy expression.
  5. By using a responder policy, you can perform the following based on gRPC status code.

Configure gRPC call termination with responder policy by using the CLI

To configure gRPC call termination with the responder policy, you must complete the following steps:

  1. Enable responder feature
  2. Add responder action
  3. Add responder policy and associate responder action
  4. Bind responder policy to load balancing virtual server

Enable responder feature

To use the responder feature, you must first enable it.

At the command prompt, type:

enable ns responder

Add responder action

After enabling the feature, you must configure the responder action for handling the gRPC response based on the status code returned by the back-end server.

At the command prompt, type:

add responder action <name> <type>

Example:

add responder action grpc-act respondwith "HTTP/1.1 200 OK\r\nServer: NS-Responder\r\nContent-Type:application/grpc\r\ngrpc-status: 12\r\ngrpc-message: Not Implemented\r\n\r\n" + "Method: " + HTTP.REQ.URL+ "is not implemented."

Adding responder policy

After you configure a responder action, you must next configure a responder policy to select the gRPC request to which the Citrix ADC appliance must respond.

At the command prompt, type:

add responder policy <name> <expression> <action> [<undefaction>]-appFlowaction <actionName> Example:

add responder policy grpc-resp-pol1 HTTP.REQ.URL.NE(“/helloworld.Greeter/SayHello”) grpc-act

Bind responder policy to load balancing virtual server

To put a policy into effect, you must bind it to the load balancing virtual server with the gRPC service.

At the command prompt, type:

bind responder global <policyName> <priority> [<gotoPriorityExpression> [-type <type>] [-invoke (<labelType> <labelName>)]

Example:

bind lb vserver lb-grpc svc-grpc -policyName grpc-resp-pol1 –priority 100

For more information about responder policy, see Responder Policy topic.