api/envoy/v12/http/path_rewrite/config.proto (81 lines of code) (raw):

// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. syntax = "proto3"; package espv2.api.envoy.v12.http.path_rewrite; import "validate/validate.proto"; // Translate into a constant path with preserved query parameters // If a url_template with path variables is specified, its variables // will be converted into query parameters too. // // All following examples use path: "/prefix" // // Example 1: no url_template: // path: "/prefix" // // Request 1.1: without query parmeter // input path: "/foo/1234/create" // output path: "/prefix" // // Request 1.2: with query parameters // input path: "/foo/1234/create?bar=100" // output path: "/prefix?bar=100" // // Example 2: with url_template // path: "/prefix" // url_template: "/foo/{bookID}/create" // // Request 2.1: without query parmeter // input path: "/foo/1234/create" // output path: "/prefix?bookID=1234" // // Request 2.2: with query parameters // input path: "/foo/1234/create?bar=100" // output path: "/prefix?bar=100&bookID=1234" // message ConstantPath { // This is the final path. All incoming request paths will be // translated to this final path. string path = 1 [(validate.rules).string = { // Must not be empty. At minimum it should have "/". min_len: 1, // Does not contain query params ('?', '&'), fragments ('#'), or invalid // HTTP_HEADER_VALUE ('\r', '\n', '\0') characters. pattern: '^[^?&#\\r\\n\\0]+$', }]; // If not empty, specify the url template with variable names. // The variable names and their values will be converted to query parameters. string url_template = 2; } // The per-route configuration specified in RouteEntry PerFilterConfig. message PerRouteFilterConfig { oneof path_translation_specifier { option (validate.required) = true; // Prepend the following path_prefix to the incoming request path. // The whole path including its query parameters will not appended. string path_prefix = 1 [(validate.rules).string = { // Must be more than "/". min_len: 2, // Does not contain query params ('?', '&'), fragments ('#'), or invalid // HTTP_HEADER_VALUE ('\r', '\n', '\0') characters. pattern: '^[^?&#\\r\\n\\0]+$', }]; // Translate to a constant path. ConstantPath constant_path = 2; // In the future, other path translation methods may be added } } // Filter level config is not needed. // All configurations are moved to RouteEntry PerFilterConfig as per-route // config. message FilterConfig {}