Skip to content

Commit 9ee4438

Browse files
authored
Drop use of If/Else
1 parent 61d58cf commit 9ee4438

File tree

1 file changed

+8
-24
lines changed

1 file changed

+8
-24
lines changed

h5bp/web_performance/cache-control.conf

+8-24
Original file line numberDiff line numberDiff line change
@@ -16,41 +16,25 @@
1616
<IfModule mod_headers.c>
1717

1818
# No content
19-
<If "-z %{CONTENT_TYPE}">
20-
Header merge Cache-Control "no-store"
21-
</If>
19+
Header merge Cache-Control "no-store" "expr=%{CONTENT_TYPE} -z"
2220

2321
# Manifest files
24-
<ElseIf "%{CONTENT_TYPE} =~ m#application/manifest\+json#i">
25-
Header merge Cache-Control "public"
26-
</ElseIf>
27-
<ElseIf "%{CONTENT_TYPE} =~ m#text/cache-manifest#i">
28-
Header merge Cache-Control "no-cache"
29-
</ElseIf>
22+
Header merge Cache-Control "public" "expr=%{CONTENT_TYPE} =~ m#application/manifest\+json#i"
23+
Header merge Cache-Control "no-cache" "expr=%{CONTENT_TYPE} =~ m#text/cache-manifest#i"
3024

3125
# Assets
32-
<ElseIf "%{CONTENT_TYPE} =~ m#image/svg\+xml#i">
33-
Header merge Cache-Control "public, immutable, stale-while-revalidate"
34-
</ElseIf>
26+
Header merge Cache-Control "public, immutable, stale-while-revalidate" "expr=%{CONTENT_TYPE} =~ m#image/svg\+xml#i"
3527

3628
# Data interchange
37-
<ElseIf "%{CONTENT_TYPE} =~ m#application/(atom|rdf|rss)\+xml#i">
38-
Header merge Cache-Control "public, stale-while-revalidate"
39-
</ElseIf>
29+
Header merge Cache-Control "public, stale-while-revalidate" "expr=%{CONTENT_TYPE} =~ m#application/(atom|rdf|rss)\+xml#i"
4030

4131
# Documents
42-
<ElseIf "%{CONTENT_TYPE} =~ m#text/(html|markdown|calendar)#i">
43-
Header merge Cache-Control "private, must-revalidate"
44-
</ElseIf>
32+
Header merge Cache-Control "private, must-revalidate" "expr=%{CONTENT_TYPE} =~ m#text/(html|markdown|calendar)#i"
4533

4634
# Data
47-
<ElseIf "%{CONTENT_TYPE} =~ m#json|xml#i">
48-
Header merge Cache-Control "no-cache"
49-
</ElseIf>
35+
Header merge Cache-Control "no-cache" "expr=%{CONTENT_TYPE} =~ m#json|xml#i"
5036

5137
# Default
52-
<Else>
53-
Header merge Cache-Control "public, immutable, stale-while-revalidate"
54-
</Else>
38+
# Header merge Cache-Control "public, immutable, stale-while-revalidate" "expr=%{CONTENT_TYPE}"
5539

5640
</IfModule>

0 commit comments

Comments
 (0)