-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathredirect-rules.json
More file actions
68 lines (68 loc) · 2.68 KB
/
Copy pathredirect-rules.json
File metadata and controls
68 lines (68 loc) · 2.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
{
"documentation": "cloudflare/redirect-rules.md explains every clause below. This file is what gets applied.",
"languages": {
"comment": "{$languages} below is filled in from the lang/ directory, every language except the default one. $default is the default. Neither is written out here, so adding a language is adding lang/<code>.php and nothing else.",
"default": "en"
},
"ruleset": {
"name": "Zone-level dynamic redirects",
"kind": "zone",
"phase": "http_request_dynamic_redirect"
},
"rules": [
{
"ref": "root_language_we_publish",
"description": "root: language we publish",
"enabled": true,
"expression": "http.host in {\"www.monicahq.com\" \"monicahq.com\"} and http.request.uri.path eq \"/\" and substring(lower(http.request.accepted_languages[0]), 0, 2) in {$languages}",
"action": "redirect",
"action_parameters": {
"from_value": {
"status_code": 302,
"target_url": {
"expression": "concat(\"https://\", http.host, \"/\", substring(lower(http.request.accepted_languages[0]), 0, 2), \"/\")"
},
"preserve_query_string": true
}
}
},
{
"ref": "root_default_language",
"description": "root: default language",
"enabled": true,
"expression": "http.host in {\"www.monicahq.com\" \"monicahq.com\"} and http.request.uri.path eq \"/\" and not (substring(lower(http.request.accepted_languages[0]), 0, 2) in {$languages})",
"action": "redirect",
"action_parameters": {
"from_value": {
"status_code": 302,
"target_url": {
"expression": "concat(\"https://\", http.host, \"/$default/\")"
},
"preserve_query_string": true
}
}
}
],
"verify": [
{
"url": "https://www.monicahq.com/",
"accept_language": "fr-CA,fr;q=0.9,en;q=0.8",
"expect": "https://www.monicahq.com/fr/"
},
{
"url": "https://www.monicahq.com/",
"accept_language": "ja,ko;q=0.8",
"expect": "https://www.monicahq.com/en/"
},
{
"url": "https://monicahq.com/",
"accept_language": "nl-BE",
"expect": "https://monicahq.com/nl/"
},
{
"url": "https://monicahq.com/",
"accept_language": "ja",
"expect": "https://monicahq.com/en/"
}
]
}