[Factory Configuration] How To - Add Mime Types to an app (web.config manipulation)
Forge component by OutSystems R&D

Within OutSystems Cloud, unfortunately, isn't possible to access the IIS directly. Even when you need to change some simple configurations, like adding a specific header to the web.config file or increase the IIS limits to upload files. However, using a powerful tool available for everyone within forge (Factory Configuration) we are allowed to manipulate and include that so much required headers in the web file config.  


1 - Download and Install on your environment the Forge component "Factory Configuration" (https://www.outsystems.com/forge/component-overview/25/factory-configuration)

2 - Open the page https://<Environment_URL>/FactoryConfiguration in a browser and log in using Service Center Credentials.

3 - Click on "Shared Configuration" > "Create New Shared Configuration"

4 - Add a meaningful "Name" to the configuration and add the XSLT template to the "Value" input by clicking the button "FILL"

5 - Look for and replace the two following lines:

<xsl:attribute name="executionTimeout">180</xsl:attribute>
<xsl:attribute name="maxRequestLength">65536</xsl:attribute>

with the mime types that you want to add:

     <mimeMap fileExtension=".xod" mimeType="application/octet-stream" />
     <mimeMap fileExtension=".res" mimeType="application/octet-stream" />
     <mimeMap fileExtension=".mem" mimeType="application/octet-stream" />
     <mimeMap fileExtension=".wasm" mimeType="application/wasm" />
     <mimeMap fileExtension=".nmf" mimeType="application/octet-stream" />

afterward, search for the following line:

<xsl:template match="/configuration/system.web/httpRuntime">

and replace with:

<xsl:template match="/configuration/system.webServer">

6 - Click on tab "eSpaces" > search for the module that you want to change the headers > check the modules you want to add the configuration and click "Associate Shared Configuration"

7 - After finishing the steps above, don't forget to REPUBLISH your module.

8 - After republishing the module you should be able to use files with the mime types that you added.

Keep in mind that adding a mime type that already exists will result in the following error when publishing the application in the Service Center:

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.