Skip to content

Commit ef84bf3

Browse files
darorasupa-alex
authored andcommitted
feat: configure Envoy to compress additional response types
Adds a number of Postgrest response types for compression by Envoy, enables gzip and brotli compression, and defaults to `br` compression (e.g. for `Accept-Encoding: *`).
1 parent f9cee1e commit ef84bf3

File tree

2 files changed

+76
-4
lines changed

2 files changed

+76
-4
lines changed

ansible/files/envoy_config/lds.yaml

Lines changed: 75 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,76 @@ resources:
8989
source_codes:
9090
remove_apikey_query_parameter:
9191
filename: /etc/envoy/remove_apikey_query_parameter.lua
92+
- name: envoy.filters.http.compressor.brotli
93+
typed_config:
94+
'@type': >-
95+
type.googleapis.com/envoy.extensions.filters.http.compressor.v3.Compressor
96+
response_direction_config:
97+
common_config:
98+
min_content_length: 100
99+
content_type:
100+
- application/vnd.pgrst.object+json
101+
- application/vnd.pgrst.array+json
102+
- application/openapi+json
103+
- application/geo+json
104+
- text/csv
105+
- application/vnd.pgrst.plan
106+
- application/vnd.pgrst.object
107+
- application/vnd.pgrst.array
108+
- application/javascript
109+
- application/json
110+
- application/xhtml+xml
111+
- image/svg+xml
112+
- text/css
113+
- text/html
114+
- text/plain
115+
- text/xml
116+
disable_on_etag_header: true
117+
request_direction_config:
118+
common_config:
119+
enabled:
120+
default_value: false
121+
runtime_key: request_compressor_enabled
122+
compressor_library:
123+
name: text_optimized
124+
typed_config:
125+
'@type': >-
126+
type.googleapis.com/envoy.extensions.compression.brotli.compressor.v3.Brotli
127+
- name: envoy.filters.http.compressor.gzip
128+
typed_config:
129+
'@type': >-
130+
type.googleapis.com/envoy.extensions.filters.http.compressor.v3.Compressor
131+
response_direction_config:
132+
common_config:
133+
min_content_length: 100
134+
content_type:
135+
- application/vnd.pgrst.object+json
136+
- application/vnd.pgrst.array+json
137+
- application/openapi+json
138+
- application/geo+json
139+
- text/csv
140+
- application/vnd.pgrst.plan
141+
- application/vnd.pgrst.object
142+
- application/vnd.pgrst.array
143+
- application/javascript
144+
- application/json
145+
- application/xhtml+xml
146+
- image/svg+xml
147+
- text/css
148+
- text/html
149+
- text/plain
150+
- text/xml
151+
disable_on_etag_header: true
152+
request_direction_config:
153+
common_config:
154+
enabled:
155+
default_value: false
156+
runtime_key: request_compressor_enabled
157+
compressor_library:
158+
name: text_optimized
159+
typed_config:
160+
'@type': >-
161+
type.googleapis.com/envoy.extensions.compression.gzip.compressor.v3.Gzip
92162
- name: envoy.filters.http.router
93163
typed_config:
94164
'@type': >-
@@ -181,12 +251,14 @@ resources:
181251
retry_policy:
182252
num_retries: 3
183253
retry_on: 5xx
254+
timeout: 35s
184255
typed_per_filter_config: *ref_0
185256
- match:
186257
prefix: /auth/v1/
187258
route:
188259
cluster: gotrue
189260
prefix_rewrite: /
261+
timeout: 35s
190262
- match:
191263
prefix: /rest/v1/
192264
query_parameters:
@@ -197,7 +269,7 @@ resources:
197269
route:
198270
cluster: postgrest
199271
prefix_rewrite: /
200-
timeout: 120s
272+
timeout: 125s
201273
typed_per_filter_config:
202274
envoy.filters.http.lua:
203275
'@type': >-
@@ -210,7 +282,7 @@ resources:
210282
route:
211283
cluster: postgrest
212284
prefix_rewrite: /
213-
timeout: 120s
285+
timeout: 125s
214286
- match:
215287
prefix: /rest-admin/v1/
216288
query_parameters:
@@ -242,7 +314,7 @@ resources:
242314
route:
243315
cluster: postgrest
244316
prefix_rewrite: /rpc/graphql
245-
timeout: 120s
317+
timeout: 125s
246318
- match:
247319
prefix: /admin/v1/
248320
route:

common-nix.vars.pkr.hcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
postgres-version = "15.6.1.115"
1+
postgres-version = "15.6.1.116"

0 commit comments

Comments
 (0)