ADC

gRPC with rewrite policy

The gRPC with rewrite policy use case explains how NetScaler appliance works in rewriting some information in the gRPC requests or responses. The following diagram shows the components interact.

The following diagram shows how components interact with each other in a gRPC with rewrite policy configuration. gRPC with rewrite policy

  1. Enable rewrite feature on the appliance.
  2. Configure rewrite action to modify, add, or delete gRPC headers.
  3. Configure rewrite policy for determining the gRPC requests (traffic) on which an action has to be taken.
  4. Bind the rewrite policy to the load balancing virtual server to examine if the traffic matches the policy expression.
  5. By using a rewrite policy, you can perform the following based on gRPC status code.
    1. Modify responses from gRPC web server.
    2. Modify, add, or delete gRPC headers.
    3. Modify the URL of the request to the gRRC server.

Configure gRPC call termination with rewrite policy

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

  1. Enable rewrite feature
  2. Add rewrite policy
  3. Bind rewrite policy to load balancing virtual server

Enable rewrite feature

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

At the command prompt, type:

enable ns rewrite

Add rewrite policy

After you configure a rewrite action, you must next configure a rewrite policy to select the gRPC requests to which the NetScaler appliance must rewrite.

At the command prompt, type:

add rewrite policy <name> <expression> <action> [<undefaction>]-appFlowaction <actionName>

Example:

add rewrite policy grpc-rewr_pol1 "http.res.header(\"grpc-status\").NE(\"0\")" RESET

Bind rewrite 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 rewrite global <policyName> <priority> [<gotoPriorityExpression> [-type <type>] [-invoke (<labelType> <labelName>)]

Example:

bind lb vserver lb-grpc –policyName grpc-rewr_pol1 –priority 100

gRPC with rewrite policy