...
1syntax = "proto3";
2
3package io.linkerd.proxy.http_route;
4option go_package = "github.com/linkerd/linkerd2-proxy-api/go/http_route";
5
6import "http_types.proto";
7
8// Describes how to match an `:authority` or `host` header.
9message HostMatch {
10 oneof match {
11 // Match an exact hostname, e.g. www.example.com.
12 string exact = 1;
13
14 // Match a hostname as a wildcard suffix, e.g. *.example.com.
15 Suffix suffix = 2;
16 }
17
18 // A match like `*.example.com` is encoded as [com, example].
19 message Suffix { repeated string reverse_labels = 1; }
20}
21
22// Describes a set of matches, ALL of which must apply.
23message HttpRouteMatch {
24 // Matches requests by path.
25 PathMatch path = 1;
26
27 // A set of header value matches that must be satisified. This match is not
28 // comprehensive, so requests may include headers that are not covered by this
29 // match.
30 repeated HeaderMatch headers = 2;
31
32 // A set of query parmaeter value matches that must be satisified. This match
33 // is not comprehensive, so requests may include query parameters that are not
34 // covered by this match.
35 repeated QueryParamMatch query_params = 3;
36
37 // If specified, restricts the match to a single HTTP method.
38 io.linkerd.proxy.http_types.HttpMethod method = 4;
39}
40
41// Describes how to match a path.
42message PathMatch {
43 oneof kind {
44 string exact = 1;
45 string prefix = 2;
46 string regex = 3;
47 }
48}
49
50// Describes how to match a header by name and value.
51message HeaderMatch {
52 string name = 1;
53
54 oneof value {
55 bytes exact = 2;
56 string regex = 3;
57 }
58}
59
60// Describes how to match a query parameter by name and value.
61message QueryParamMatch {
62 string name = 1;
63
64 oneof value {
65 string exact = 2;
66 string regex = 3;
67 }
68}
69
70// Configures a route to modify a request's headers.
71//
72// Modifications are to be applied in the order they are described here:
73// additions apply first, then sets, and then removals.
74message RequestHeaderModifier {
75 // A list of headers name-value pairs to set on requests, augmenting any
76 // existing values for the header.
77 io.linkerd.proxy.http_types.Headers add = 1;
78
79 // A list of headers name-value pairs to set on requests, replacing any
80 // existing values for the header.
81 io.linkerd.proxy.http_types.Headers set = 2;
82
83 // A list of headers names to be removed from requests.
84 repeated string remove = 3;
85}
86
87// Configures a route to modify a response's headers.
88//
89// Modifications are to be applied in the order they are described here:
90// additions apply first, then sets, and then removals.
91message ResponseHeaderModifier {
92 // A list of headers name-value pairs to set on responses, augmenting any
93 // existing values for the header.
94 io.linkerd.proxy.http_types.Headers add = 1;
95
96 // A list of headers name-value pairs to set on responses, replacing any
97 // existing values for the header.
98 io.linkerd.proxy.http_types.Headers set = 2;
99
100 // A list of headers names to be removed from responses.
101 repeated string remove = 3;
102}
103
104
105// Configures a route to respond with a redirect response. The `location` header
106// is set with the given URL parameters.
107message RequestRedirect {
108 // The scheme value to be used in the `location` header. If not specified,
109 // the original request's scheme is used.
110 io.linkerd.proxy.http_types.Scheme scheme = 1;
111
112 // The host value to be used in the `location` header. If not specified, the
113 // original request's host is used.
114 string host = 2;
115
116 // If set, configures how the request's path should be modified for use in
117 // the `location` header. If not specified, the original request's path is
118 // used.
119 PathModifier path = 3;
120
121 // If set, specifies the port to use in the `location` header.
122 uint32 port = 4;
123
124 // The status code to use in the HTTP response. If not specified, 301 is
125 // used.
126 uint32 status = 5;
127}
128
129// Describes how a path value may be rewritten in a route.
130message PathModifier {
131 oneof replace {
132 // Indicates that the path should be replaced with the given value.
133 string full = 1;
134
135 // Indicates that the path prefix should be replaced with the given
136 // value. When used, the route MUST match the request with PathMatch
137 // prefix match. Server implementations SHOULD prevent the useof prefix
138 // modifiers on routes that do use a PathMatch prefix match. Proxyies
139 // MUST not process requests for routes where this condition is not
140 // satisfied.
141 string prefix = 2;
142 }
143}
144
145// Configures a route to respond with a fixed response.
146message HttpFailureInjector {
147 // The status code to use in the HTTP response. Must be specified.
148 uint32 status = 1;
149
150 // An error message to log and include in the `l5d-proxy-err` header.
151 string message = 2;
152
153 // If specified, the rate of requests that should be failed. If not specified,
154 // ALL requests are failed.
155 Ratio ratio = 3;
156}
157
158// A ratio (i.e., of requests) to which an filter should be applied.
159//
160// Represents fractional values on [0, 1].
161message Ratio {
162 uint32 numerator = 1;
163
164 // MUST not be zero.
165 uint32 denominator = 2;
166}
View as plain text