If you host an Angular application on Microsoft Azure you probably want to define a mime map for .json and .woff / .woff2 files to get rid of the console errors. Also to enable client-side routing we have to add a rewrite rule.
This is how my web.config looks like:
x
23
1
2
<configuration>
3
<system.webServer>
4
<staticContent>
5
<mimeMap fileExtension=".json" mimeType="application/json" />
6
<remove fileExtension=".woff" />
7
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />
8
<mimeMap fileExtension=".woff2" mimeType="font/woff2" />
9
</staticContent>
10
<rewrite>
11
<rules>
12
<rule name="Angular" stopProcessing="true">
13
<match url=".*" />
14
<conditions logicalGrouping="MatchAll">
15
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
16
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
17
</conditions>
18
<action type="Rewrite" url="/" />
19
</rule>
20
</rules>
21
</rewrite>
22
</system.webServer>
23
</configuration>
To ensure the config gets deployed, put it in the src directory:
And add it to list of assets within the .angular-cli.json: