v0.42.0
This commit is contained in:
1 parent
6df256cdbb
commit
0d6249e383
159 files changed
+16737
-1971
No files matched your search
@@ -0,0 +1,6 @@
|
||||
# Import this snippet in the HTTP policy editor, then save the resulting draft.
|
||||
acl vary_duplicate res.fhdr_cnt(Vary) eq 2
|
||||
acl vary_encoding res.fhdr(Vary) -i Accept-Encoding
|
||||
acl vary_combined res.fhdr(Vary) -i "Accept,Accept-Encoding" "Accept, Accept-Encoding"
|
||||
|
||||
http-response set-header Vary "Accept, Accept-Encoding" if vary_duplicate vary_encoding vary_combined
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"vhosts": [
|
||||
{
|
||||
"id": "app",
|
||||
"frontend": {"hosts": ["*"]},
|
||||
"backends": [{"id": "origin", "url": "http://127.0.0.1:9000", "allow_private": true}],
|
||||
"load_balancing": {"health_check": {"mode": "off"}},
|
||||
"policy": {
|
||||
"acls": {
|
||||
"vary_duplicate": {"fetch": "res.fhdr_cnt(Vary)", "operator": "eq", "values": ["2"]},
|
||||
"vary_encoding": {"fetch": "res.fhdr(Vary)", "operator": "equals", "ignore_case": true, "values": ["Accept-Encoding"]},
|
||||
"vary_combined": {"fetch": "res.fhdr(Vary)", "operator": "equals", "ignore_case": true, "values": ["Accept,Accept-Encoding", "Accept, Accept-Encoding"]}
|
||||
},
|
||||
"rules": [
|
||||
{
|
||||
"id": "combine-duplicate-vary",
|
||||
"stage": "backend_response",
|
||||
"when": {"all": [{"acl": "vary_duplicate"}, {"acl": "vary_encoding"}, {"acl": "vary_combined"}]},
|
||||
"actions": [{"type": "set_header", "name": "Vary", "value": "Accept, Accept-Encoding"}]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
{
|
||||
"cache": {"enabled": true, "expose_status": true},
|
||||
"policy": {
|
||||
"rules": [
|
||||
{
|
||||
"id": "normalize-final-vary",
|
||||
"stage": "after_response",
|
||||
"actions": [{"type": "normalize_header", "name": "Vary"}]
|
||||
}
|
||||
]
|
||||
},
|
||||
"vhosts": [
|
||||
{
|
||||
"id": "app",
|
||||
"frontend": {"hosts": ["*"]},
|
||||
"backends": [{"id": "origin", "url": "http://127.0.0.1:9000", "allow_private": true}],
|
||||
"load_balancing": {"health_check": {"mode": "off"}},
|
||||
"policy": {
|
||||
"acls": {
|
||||
"mobile": {"fetch": "req.fhdr(User-Agent)", "operator": "contains", "values": ["mobile"], "ignore_case": true}
|
||||
},
|
||||
"rules": [
|
||||
{"id": "default-device", "stage": "request", "actions": [{"type": "set_header", "name": "X-Device", "value": "desktop"}]},
|
||||
{"id": "mobile-device", "stage": "request", "when": {"acl": "mobile"}, "actions": [{"type": "set_header", "name": "X-Device", "value": "mobile"}]},
|
||||
{"id": "downstream-device-variant", "stage": "backend_response", "actions": [{"type": "merge_header", "name": "Vary", "value": "User-Agent"}]},
|
||||
{"id": "cache-diagnostic", "stage": "after_response", "actions": [{"type": "set_header", "name": "X-Policy-Cache", "value": "%[cache_status]"}]}
|
||||
]
|
||||
},
|
||||
"cache": {
|
||||
"enabled": true,
|
||||
"rules": [
|
||||
{
|
||||
"id": "private-api",
|
||||
"stage": "request",
|
||||
"conditions": [{"field": "path", "operator": "prefix", "values": ["/api/"]}],
|
||||
"actions": [{"type": "pass"}],
|
||||
"stop": true
|
||||
},
|
||||
{
|
||||
"id": "device-variant",
|
||||
"stage": "request",
|
||||
"hash_stage": true,
|
||||
"conditions": [],
|
||||
"actions": [{"type": "hash_header", "name": "X-Device"}]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in new issue
Block a user