title: HttpPlatformHandler HTTP Error 502.3 - Bad Gateway
body: <p>I am trying to run rails on IIS, I followed the steps mentioned <a href="https://www.hanselman.com/blog/AnnouncingRunningRubyOnRailsOnIIS8OrAnythingElseReallyWithTheNewHttpPlatformHandler.aspx" rel="noreferrer">here</a> by 
  Scott Hanselman.</p>
  
  <p>Here's some info that might help:</p>
  
  <ul>
  <li>Rails version: 5.1.4</li>
  <li>Ruby version: 2.3.3</li>
  </ul>
  
  <p>After I followed the setup steps, I countered this issue</p>
  
  <blockquote>
    <p>HTTP Error 502.3 - Bad Gateway </p>
    
    <p>There was a connection error while trying to route the request.</p>
    
    <p>Most likely causes:</p>
    
    <ul>
    <li><p>The CGI application did not return a valid set of HTTP errors.</p></li>
    <li><p>A server acting as a proxy or gateway was unable to process the request due to an error in a parent gateway.</p></li>
    </ul>
    
    <p>Things you can try:</p>
    
    <ul>
    <li><p>Use DebugDiag to troubleshoot the CGI application.</p></li>
    <li><p>Determine if a proxy or gateway is responsible for this error.</p></li>
    </ul>
  </blockquote>
  
  <p>Here is my <code>web.config</code> file content.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;configuration&gt;
    &lt;system.webServer&gt;
      &lt;handlers&gt;
        &lt;add name="httpplatformhandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" requireAccess="Script" /&gt;
      &lt;/handlers&gt;
      &lt;httpPlatform processPath="C:\RailsInstaller\Ruby2.3.3\bin\ruby.exe" arguments="&amp;quot;C:\RailsInstaller\Ruby2.3.3\bin\rails&amp;quot; server -p %HTTP_PLATFORM_PORT% -b 127.0.0.1" startupTimeLimit="200" stdoutLogEnabled="true" stdoutLogFile="rails.log"&gt;
        &lt;environmentVariables&gt;
          &lt;environmentVariable name="RAILS_ENV" value="development" /&gt;
        &lt;/environmentVariables&gt;
      &lt;/httpPlatform&gt;
      &lt;directoryBrowse enabled="true" showFlags="Date, Time, Size, Extension" /&gt;
    &lt;/system.webServer&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>I am not sure what the problem is, and what configurations I miss!</p>