From fbdd92fc99409ab2f1a7920b256ad3c582e4aaf7 Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Fri, 26 Jul 2013 14:14:40 +0000
Subject: [PATCH] Add web.config for IIS to serve the API

---
 web.config | 47 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)
 create mode 100644 web.config

diff --git a/web.config b/web.config
new file mode 100644
index 000000000..fd61b6a95
--- /dev/null
+++ b/web.config
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration>
+
+    <configSections>
+        <sectionGroup name="system.webServer">
+            <sectionGroup name="rewrite">
+                <section name="rewriteMaps" overrideModeDefault="Allow" />
+                <section name="rules" overrideModeDefault="Allow" />
+            </sectionGroup>
+        </sectionGroup>
+    </configSections>
+
+    <system.webServer>
+        <directoryBrowse enabled="false" />
+        <rewrite>
+            <rules>
+                <rule name="HTTP api" stopProcessing="true">
+                    <match url="^(.*/)?api/(.*)$" ignoreCase="true"/>
+                    <conditions>
+                        <add input="{REQUEST_FILENAME}" matchType="IsFile"
+                            ignoreCase="false" negate="true" />
+                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory"
+                            ignoreCase="false" negate="true" />
+                    </conditions>
+                    <action type="Rewrite" url="{R:1}api/http.php/{R:2}"/>
+                </rule>
+                <rule name="Site pages" stopProcessing="true">
+                    <match url="^(.*/)?pages/(.*)$" ignoreCase="true"/>
+                    <conditions>
+                        <add input="{REQUEST_FILENAME}" matchType="IsFile"
+                            ignoreCase="false" negate="true" />
+                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory"
+                            ignoreCase="false" negate="true" />
+                    </conditions>
+                    <action type="Rewrite" url="{R:1}pages/index.php/{R:2}"/>
+                </rule>
+            </rules>
+        </rewrite>
+        <defaultDocument>
+            <files>
+                <remove value="index.php" />
+                <add value="index.php" />
+            </files>
+        </defaultDocument>
+    </system.webServer>
+
+</configuration>
-- 
GitLab