Skip to content

Commit 0694d5c

Browse files
committed
Unit: add processing of static gzip assets
- routes are renamed to use "pass" for header check - formatted to compare with output from server
1 parent 76f8b23 commit 0694d5c

File tree

1 file changed

+183
-113
lines changed

1 file changed

+183
-113
lines changed

docker/unit.json

Lines changed: 183 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -1,115 +1,185 @@
11
{
2-
"listeners": {
3-
"*:80": {
4-
"pass": "routes"
5-
}
6-
},
7-
"routes": [
8-
{
9-
"match": {
10-
"uri": [
11-
"!*/.well-known/*",
12-
"/vendor/*",
13-
"/core/profiles/demo_umami/modules/demo_umami_content/default_content/*",
14-
"*.engine",
15-
"*.inc",
16-
"*.install",
17-
"*.make",
18-
"*.module",
19-
"*.po",
20-
"*.profile",
21-
"*.sh",
22-
"*.theme",
23-
"*.tpl",
24-
"*.twig",
25-
"*.xtmpl",
26-
"*.yml",
27-
"*/.*",
28-
"*/Entries*",
29-
"*/Repository",
30-
"*/Root",
31-
"*/Tag",
32-
"*/Template",
33-
"*/composer.json",
34-
"*/composer.lock",
35-
"*/web.config",
36-
"*sql",
37-
"*.bak",
38-
"*.orig",
39-
"*.save",
40-
"*.swo",
41-
"*.swp",
42-
"*~"
43-
]
44-
},
45-
"action": {
46-
"return": 404
47-
}
48-
},
49-
{
50-
"match": {
51-
"uri": [
52-
"/core/authorize.php",
53-
"/core/install.php",
54-
"/core/modules/statistics/statistics.php",
55-
"~^/core/modules/system/tests/https?\\.php",
56-
"/core/rebuild.php",
57-
"/update.php",
58-
"/update.php/*"
59-
]
60-
},
61-
"action": {
62-
"pass": "applications/drupal/direct"
63-
}
64-
},
65-
{
66-
"match": {
67-
"uri": [
68-
"!/index.php*",
69-
"*.php"
70-
]
71-
},
72-
"action": {
73-
"return": 404
74-
}
75-
},
76-
{
77-
"action": {
78-
"share": "/var/www/html/web$uri",
79-
"fallback": {
80-
"pass": "applications/drupal/index"
81-
}
82-
}
83-
}
84-
],
85-
"applications": {
86-
"drupal": {
87-
"type": "php",
88-
"processes": {
89-
"max": 4,
90-
"spare": 2,
91-
"idle_timeout": 120
92-
},
93-
"limits": {
94-
"timeout": 300,
95-
"requests": 1500
96-
},
97-
"options": {
98-
"admin": {
99-
"memory_limit": "1G",
100-
"opcache.jit_buffer_size": "20M"
101-
}
102-
},
103-
"targets": {
104-
"direct": {
105-
"root": "/var/www/html/web/"
106-
},
107-
"index": {
108-
"root": "/var/www/html/web/",
109-
"script": "index.php"
110-
}
111-
}
112-
}
113-
},
114-
"access_log": "/dev/stdout"
2+
"access_log": "/dev/stdout",
3+
"listeners": {
4+
"*:80": {
5+
"pass": "routes/main"
6+
}
7+
},
8+
9+
"routes": {
10+
"main": [
11+
{
12+
"match": {
13+
"uri": [
14+
"!*/.well-known/*",
15+
"/vendor/*",
16+
"/core/profiles/demo_umami/modules/demo_umami_content/default_content/*",
17+
"*.engine",
18+
"*.inc",
19+
"*.install",
20+
"*.make",
21+
"*.module",
22+
"*.po",
23+
"*.profile",
24+
"*.sh",
25+
"*.theme",
26+
"*.tpl",
27+
"*.twig",
28+
"*.xtmpl",
29+
"*.yml",
30+
"*/.*",
31+
"*/Entries*",
32+
"*/Repository",
33+
"*/Root",
34+
"*/Tag",
35+
"*/Template",
36+
"*/composer.json",
37+
"*/composer.lock",
38+
"*/web.config",
39+
"*sql",
40+
"*.bak",
41+
"*.orig",
42+
"*.save",
43+
"*.swo",
44+
"*.swp",
45+
"*~"
46+
]
47+
},
48+
49+
"action": {
50+
"return": 404
51+
}
52+
},
53+
{
54+
"match": {
55+
"uri": [
56+
"/core/authorize.php",
57+
"/core/install.php",
58+
"/core/modules/statistics/statistics.php",
59+
"~^/core/modules/system/tests/https?\\.php",
60+
"/core/rebuild.php",
61+
"/update.php",
62+
"/update.php/*"
63+
]
64+
},
65+
66+
"action": {
67+
"pass": "applications/drupal/direct"
68+
}
69+
},
70+
{
71+
"match": {
72+
"uri": [
73+
"!/index.php*",
74+
"*.php"
75+
]
76+
},
77+
78+
"action": {
79+
"return": 404
80+
}
81+
},
82+
{
83+
"match": {
84+
"uri": [
85+
"~^.*css_[a-zA-Z0-9-_]+\\.css(?:\\?.*)?$",
86+
"~^.*js_[a-zA-Z0-9-_]+\\.js(?:\\?.*)?$"
87+
],
88+
89+
"headers": [
90+
{
91+
"Accept-Encoding": "*gzip*"
92+
}
93+
]
94+
},
95+
96+
"action": {
97+
"pass": "routes/assets_gz"
98+
}
99+
},
100+
{
101+
"action": {
102+
"share": "/var/www/html/web$uri",
103+
"fallback": {
104+
"pass": "applications/drupal/index"
105+
}
106+
}
107+
}
108+
],
109+
110+
"assets_gz": [
111+
{
112+
"match": {
113+
"headers": [
114+
{
115+
"Accept-Encoding": "*gzip*"
116+
}
117+
]
118+
},
119+
120+
"action": {
121+
"share": "/var/www/html/web${uri}.gz",
122+
"response_headers": {
123+
"Content-Encoding": "gzip"
124+
},
125+
126+
"fallback": {
127+
"pass": "routes/assets"
128+
}
129+
}
130+
},
131+
{
132+
"action": {
133+
"pass": "routes/assets"
134+
}
135+
}
136+
],
137+
138+
"assets": [
139+
{
140+
"action": {
141+
"share": "/var/www/html/web${uri}",
142+
"fallback": {
143+
"pass": "applications/drupal/index"
144+
}
145+
}
146+
}
147+
]
148+
},
149+
150+
"applications": {
151+
"drupal": {
152+
"type": "php",
153+
"stdout": "/dev/stdout",
154+
"stderr": "/dev/stderr",
155+
"processes": {
156+
"max": 4,
157+
"spare": 2,
158+
"idle_timeout": 120
159+
},
160+
161+
"limits": {
162+
"timeout": 300,
163+
"requests": 1500
164+
},
165+
166+
"options": {
167+
"admin": {
168+
"memory_limit": "1G",
169+
"opcache.jit_buffer_size": "20M"
170+
}
171+
},
172+
173+
"targets": {
174+
"direct": {
175+
"root": "/var/www/html/web/"
176+
},
177+
178+
"index": {
179+
"root": "/var/www/html/web/",
180+
"script": "index.php"
181+
}
182+
}
183+
}
184+
}
115185
}

0 commit comments

Comments
 (0)