Skip to content

Instantly share code, notes, and snippets.

@Sophrinix Sophrinix/web.config
Created Jan 19, 2013

Embed
What would you like to do?
a known working web.config for IIS 7.5 HTTP verbs are explicitly listed. This uses FCGI through rack on ruby 1.9.3p194 64 bit.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<heliconZoo>
<!-- These settings are applied when IIS application pool uses 32-bit CPU mode -->
<application name="rails.project">
<environmentVariables>
<add name="HOME" value="%APPL_PHYSICAL_PATH%" />
<add name="GEM_HOME" value="&quot;%APPL_PHYSICAL_PATH%\vendor\gems\ruby\1.9.1\&quot;" />
<add name="RAILS_RELATIVE_URL_ROOT" value="%APPL_VIRTUAL_PATH%" />
<!--
Deploy file includes the most common commands required to prepare application before launch (bundle install, migrations etc.)
It is also possible to specify here any script which evenually will be run by rubyw.exe.
-->
<!-- <add name="DEPLOY_FILE" value="deploy.rb" /> -->
<!-- <add name="DEPLOY_LOG" value="log\zoo-deploy.log" /> -->
<!-- By default we run Rails in production mode -->
<!-- <add name="RACK_ENV" value="development" /> -->
</environmentVariables>
</application>
</heliconZoo>
<handlers>
<!-- All transports below support Rails 2.3, 3.0 and 3.1 as well as any Rack-based application. Uncomment the one you wish to use. -->
<!-- Ruby 1.9 over FastCGI -->
<add name="rails.project#x86" scriptProcessor="ruby.1.9.rack" path="*" verb="*" modules="HeliconZoo_x86" preCondition="bitness32" resourceType="Unspecified" requireAccess="Script" />
<add name="rails.project#x64" scriptProcessor="ruby.1.9.rack" path="*" verb="*" modules="HeliconZoo_x64" preCondition="bitness64" resourceType="Unspecified" requireAccess="Script" />
<!-- Ruby 1.8 over FastCGI -->
<!--
<add name="rails.project#x86" scriptProcessor="ruby.1.8.pipe" path="*" verb="*" modules="HeliconZoo_x86" preCondition="bitness32" resourceType="Unspecified" requireAccess="Script" />
<add name="rails.project#x64" scriptProcessor="ruby.1.8.pipe" path="*" verb="*" modules="HeliconZoo_x64" preCondition="bitness64" resourceType="Unspecified" requireAccess="Script" />
-->
<!-- Ruby 1.9 over HTTP, using Thin as a back-end application server -->
<!--
<add name="rails.project#x86" scriptProcessor="ruby.1.9.rack" path="*" verb="*" modules="HeliconZoo_x86" preCondition="bitness32" resourceType="Unspecified" requireAccess="Script" />
<add name="rails.project#x64" scriptProcessor="ruby.1.9.rack" path="*" verb="*" modules="HeliconZoo_x64" preCondition="bitness64" resourceType="Unspecified" requireAccess="Script" />
-->
</handlers>
<!-- Send static files through IIS -->
<rewrite>
<rules>
<clear />
<rule name="Rewrite to Zoo index if that's an empty application" enabled="false" stopProcessing="true">
<match url=".?" ignoreCase="false" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="true">
<add input="{APPL_PHYSICAL_PATH}" pattern="(.*)" ignoreCase="false" />
<add input="{C:1}config\environment.rb" matchType="IsFile" negate="true" />
</conditions>
<action type="None" />
</rule>
<rule name="Static Files" enabled="true" stopProcessing="false">
<match url="^(?!public)(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="true">
<add input="{APPL_PHYSICAL_PATH}" pattern="(.*)" ignoreCase="false" />
<add input="{C:1}public\{R:1}" matchType="IsFile" />
</conditions>
<action type="Rewrite" url="public/{R:1}" />
</rule>
<rule name="Rails 3.1 assets" enabled="true" stopProcessing="false">
<match url="^assets/(.*)$" ignoreCase="true" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="true">
<add input="{APPL_PHYSICAL_PATH}" pattern="(.*)" ignoreCase="false" />
<add input="{C:1}app\assets\{R:1}" matchType="IsFile" />
</conditions>
<action type="Rewrite" url="app/assets/{R:1}" />
</rule>
<rule name="index" enabled="true" stopProcessing="false">
<match url="^$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="true">
<add input="{APPL_PHYSICAL_PATH}" pattern="(.*)" ignoreCase="false" />
<add input="{C:1}public\index.html" matchType="IsFile" />
</conditions>
<action type="Rewrite" url="http://www.WEBSITE-HERE.com" />
</rule>
</rules>
</rewrite>
<httpErrors>
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" prefixLanguageFilePath="" path="/index.html" responseMode="ExecuteURL" />
</httpErrors>
<security>
<requestFiltering>
<verbs>
<add verb="POST" allowed="true" />
<add verb="PUT" allowed="true" />
<add verb="GET" allowed="true" />
<add verb="DELETE" allowed="true" />
<add verb="PATCH" allowed="true" />
</verbs>
<fileExtensions>
<add fileExtension=".json" allowed="true" />
</fileExtensions>
</requestFiltering>
</security>
<urlCompression doStaticCompression="true" doDynamicCompression="true" />
<httpProtocol>
<customHeaders>
<remove name="X-Powered-By" />
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.