Skip to content

Instantly share code, notes, and snippets.

@arcadiogarcia
Created June 28, 2017 11:35
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save arcadiogarcia/90915843d14d53459148d77a630b93c0 to your computer and use it in GitHub Desktop.
Save arcadiogarcia/90915843d14d53459148d77a630b93c0 to your computer and use it in GitHub Desktop.
Web.config for allowing .json files in IIS (for Azure Web Apps)
<?xml version="1.0"?>
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".json" mimeType="application/json" />
</staticContent>
</system.webServer>
</configuration>
@dhulme
Copy link

dhulme commented Jun 1, 2020

Thank you :)

@feralva
Copy link

feralva commented Sep 2, 2020

This does not work for me, how is your app service configuration?

@rochapablo
Copy link

did not work for me

@xombiehamster
Copy link

This also did not work for me. Instead, it caused the application to display an internal server error. What am I doing wrong to cause this?

@khanzzirfan
Copy link

<?xml version="1.0"?>
<configuration>
<system.webServer>
 <staticContent>
  <remove fileExtension=".json"/>
  <mimeMap fileExtension=".json" mimeType="application/json"/>
</staticContent>
<rewrite>
<rules>
<rule name="React Routes" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_URI}" pattern="^/(api)" negate="true" />
</conditions>
<action type="Rewrite" url="/" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

this worked for me under web.config

@Reyescult
Copy link

The OG config worked for me. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment