|
| 1 | +<?xml version="1.0" encoding="utf-8"?> |
| 2 | +<configuration> |
| 3 | + <system.web> |
| 4 | + <customErrors mode="Off"/> |
| 5 | + </system.web> |
| 6 | + |
| 7 | + <system.webServer> |
| 8 | + |
| 9 | + <!-- Disable compression as we're doing it through pre-compressed files --> |
| 10 | + <urlCompression doStaticCompression="false" doDynamicCompression="false" dynamicCompressionBeforeCache="false" /> |
| 11 | + |
| 12 | + <staticContent> |
| 13 | + <remove fileExtension=".dll" /> |
| 14 | + <remove fileExtension=".wasm" /> |
| 15 | + <remove fileExtension=".woff" /> |
| 16 | + <remove fileExtension=".woff2" /> |
| 17 | + <mimeMap fileExtension=".wasm" mimeType="application/wasm" /> |
| 18 | + <mimeMap fileExtension=".clr" mimeType="application/octet-stream" /> |
| 19 | + <mimeMap fileExtension=".pdb" mimeType="application/octet-stream" /> |
| 20 | + <mimeMap fileExtension=".woff" mimeType="application/font-woff" /> |
| 21 | + <mimeMap fileExtension=".woff2" mimeType="application/font-woff" /> |
| 22 | + <mimeMap fileExtension=".dat" mimeType="application/octet-stream" /> |
| 23 | + <!-- Required for PWAs --> |
| 24 | + <mimeMap fileExtension=".json" mimeType="application/octet-stream" /> |
| 25 | + </staticContent> |
| 26 | + |
| 27 | + <rewrite> |
| 28 | + <rules> |
| 29 | + <rule name="Lookup for pre-compressed brotli file" stopProcessing="true"> |
| 30 | + <match url="(.*)$"/> |
| 31 | + <conditions> |
| 32 | + <!-- Match brotli requests --> |
| 33 | + <add input="{HTTP_ACCEPT_ENCODING}" pattern="br" /> |
| 34 | + |
| 35 | + <!-- Match all but pre-compressed files --> |
| 36 | + <add input="{REQUEST_URI}" pattern="^(?!/_compressed_br/)(.*)$" /> |
| 37 | + |
| 38 | + <!-- Check if the pre-compressed file exists on the disk --> |
| 39 | + <add input="{DOCUMENT_ROOT}/_compressed_br/{C:0}" matchType="IsFile" negate="false" /> |
| 40 | + </conditions> |
| 41 | + <action type="Rewrite" url="/_compressed_br{C:0}" /> |
| 42 | + </rule> |
| 43 | + |
| 44 | + <rule name="Lookup for pre-compressed gzip file" stopProcessing="true"> |
| 45 | + <match url="(.*)$"/> |
| 46 | + <conditions> |
| 47 | + <!-- Match gzip requests --> |
| 48 | + <add input="{HTTP_ACCEPT_ENCODING}" pattern="gzip" /> |
| 49 | + |
| 50 | + <!-- Match all but pre-compressed files --> |
| 51 | + <add input="{REQUEST_URI}" pattern="^(?!/_compressed_gz/)(.*)$" /> |
| 52 | + |
| 53 | + <!-- Check if the pre-compressed file exists on the disk --> |
| 54 | + <add input="{DOCUMENT_ROOT}/_compressed_gz/{C:0}" matchType="IsFile" negate="false" /> |
| 55 | + </conditions> |
| 56 | + <action type="Rewrite" url="/_compressed_gz{C:0}" /> |
| 57 | + </rule> |
| 58 | + </rules> |
| 59 | + |
| 60 | + <outboundRules> |
| 61 | + <rule name="Adjust content encoding for gzip pre-compressed files" enabled="true" stopProcessing="true"> |
| 62 | + <match serverVariable="RESPONSE_CONTENT_ENCODING" pattern="" /> |
| 63 | + <conditions> |
| 64 | + <add input="{REQUEST_URI}" pattern="/_compressed_gz/.*$" /> |
| 65 | + </conditions> |
| 66 | + <action type="Rewrite" value="gzip"/> |
| 67 | + </rule> |
| 68 | + <rule name="Adjust content encoding for brotli pre-compressed files" enabled="true" stopProcessing="true"> |
| 69 | + <match serverVariable="RESPONSE_CONTENT_ENCODING" pattern="" /> |
| 70 | + <conditions> |
| 71 | + <add input="{REQUEST_URI}" pattern="/_compressed_br/.*$" /> |
| 72 | + </conditions> |
| 73 | + <action type="Rewrite" value="br"/> |
| 74 | + </rule> |
| 75 | + </outboundRules> |
| 76 | + </rewrite> |
| 77 | + </system.webServer> |
| 78 | +</configuration> |
0 commit comments