Skip to content

Commit 5675379

Browse files
committed
chore(cd): Improve caching in crmapp web.config
1 parent c6517d7 commit 5675379

2 files changed

Lines changed: 81 additions & 55 deletions

File tree

projects/app-crm/web.config

Lines changed: 80 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,81 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<configuration>
3-
<system.webServer>
4-
<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
5-
<scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />
6-
<dynamicTypes>
7-
<add enabled="true" mimeType="text/*"/>
8-
<add enabled="true" mimeType="message/*"/>
9-
<add enabled="true" mimeType="application/javascript"/>
10-
<add enabled="true" mimeType="application/json"/>
11-
<add enabled="false" mimeType="*/*"/>
12-
</dynamicTypes>
13-
<staticTypes>
14-
<add enabled="true" mimeType="text/*"/>
15-
<add enabled="true" mimeType="message/*"/>
16-
<add enabled="true" mimeType="application/javascript"/>
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<system.webServer>
4+
<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
5+
<scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />
6+
<dynamicTypes>
7+
<add enabled="true" mimeType="text/*"/>
8+
<add enabled="true" mimeType="message/*"/>
9+
<add enabled="true" mimeType="application/javascript"/>
1710
<add enabled="true" mimeType="application/json"/>
18-
<add enabled="true" mimeType="image/svg+xml"/>
19-
<add enabled="false" mimeType="*/*"/>
20-
</staticTypes>
21-
</httpCompression>
22-
<rewrite>
23-
<rules>
24-
<rule name="Angular Routes" stopProcessing="true">
25-
<match url=".*" />
26-
<conditions logicalGrouping="MatchAll">
27-
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
28-
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
29-
</conditions>
30-
<action type="Rewrite" url="/angular-demos/" />
31-
</rule>
32-
</rules>
33-
</rewrite>
34-
<staticContent>
35-
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="365.00:00:00" />
36-
<remove fileExtension=".json" />
37-
<remove fileExtension=".csv" />
38-
<remove fileExtension=".shp" />
39-
<remove fileExtension=".dbf" />
40-
<remove fileExtension=".itf" />
41-
<remove fileExtension=".svg" />
42-
43-
<mimeMap fileExtension=".json" mimeType="application/json;charset=UTF-8;" />
44-
<mimeMap fileExtension=".csv" mimeType="application/csv;charset=UTF-8;" />
45-
<mimeMap fileExtension=".shp" mimeType="application/octet-stream" />
46-
<mimeMap fileExtension=".dbf" mimeType="application/octet-stream" />
47-
<mimeMap fileExtension=".itf" mimeType="application/octet-stream" />
48-
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
49-
</staticContent>
50-
<httpProtocol>
51-
<customHeaders>
52-
<add name="X-XSS-Protection" value="0" />
53-
</customHeaders>
54-
</httpProtocol>
55-
</system.webServer>
56-
</configuration>
11+
<add enabled="false" mimeType="*/*"/>
12+
</dynamicTypes>
13+
<staticTypes>
14+
<add enabled="true" mimeType="text/*"/>
15+
<add enabled="true" mimeType="message/*"/>
16+
<add enabled="true" mimeType="application/javascript"/>
17+
<add enabled="true" mimeType="application/json"/>
18+
<add enabled="true" mimeType="image/svg+xml"/>
19+
<add enabled="false" mimeType="*/*"/>
20+
</staticTypes>
21+
</httpCompression>
22+
<rewrite>
23+
<rules>
24+
<rule name="Angular Routes" stopProcessing="true">
25+
<match url=".*" />
26+
<conditions logicalGrouping="MatchAll">
27+
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
28+
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
29+
</conditions>
30+
<action type="Rewrite" url="/angular-demos/" />
31+
</rule>
32+
</rules>
33+
<outboundRules>
34+
<rule name="Cache immutable files" preCondition="IsImmutable">
35+
<match serverVariable="RESPONSE_Cache-Control" pattern=".*" />
36+
<action type="Rewrite" value="public, max-age=31536000, immutable" />
37+
</rule>
38+
<preConditions>
39+
<preCondition name="IsImmutable" logicalGrouping="MatchAny">
40+
<add input="{REQUEST_URI}" pattern="styles-.*\.css$" />
41+
<add input="{REQUEST_URI}" pattern="chunk-.*\.js$" />
42+
<add input="{REQUEST_URI}" pattern="main-.*\.js$" />
43+
<add input="{REQUEST_URI}" pattern="polyfills-.*\.js$" />
44+
<add input="{REQUEST_URI}" pattern="/media/.*" />
45+
</preCondition>
46+
</preConditions>
47+
</outboundRules>
48+
</rewrite>
49+
<staticContent>
50+
<!-- 1 hour public cache for regular static assets -->
51+
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="0.01:00:00" cacheControlCustom="public" />
52+
53+
<remove fileExtension=".json" />
54+
<remove fileExtension=".csv" />
55+
<remove fileExtension=".shp" />
56+
<remove fileExtension=".dbf" />
57+
<remove fileExtension=".itf" />
58+
<remove fileExtension=".svg" />
59+
60+
<mimeMap fileExtension=".json" mimeType="application/json;charset=UTF-8;" />
61+
<mimeMap fileExtension=".csv" mimeType="application/csv;charset=UTF-8;" />
62+
<mimeMap fileExtension=".shp" mimeType="application/octet-stream" />
63+
<mimeMap fileExtension=".dbf" mimeType="application/octet-stream" />
64+
<mimeMap fileExtension=".itf" mimeType="application/octet-stream" />
65+
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
66+
</staticContent>
67+
<httpProtocol>
68+
<customHeaders>
69+
<add name="X-XSS-Protection" value="0" />
70+
</customHeaders>
71+
</httpProtocol>
72+
</system.webServer>
73+
<location path="index.html">
74+
<system.webServer>
75+
<staticContent>
76+
<!-- Short-lived cache for index.html -->
77+
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="0.00:05:00" cacheControlCustom="public" />
78+
</staticContent>
79+
</system.webServer>
80+
</location>
81+
</configuration>

web.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
<staticContent>
5454
<!-- 1 hour public cache for regular static assets -->
5555
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="0.01:00:00" cacheControlCustom="public" />
56+
5657
<remove fileExtension=".json" />
5758
<remove fileExtension=".csv" />
5859
<remove fileExtension=".shp" />

0 commit comments

Comments
 (0)