<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <font face="Helvetica, Arial, sans-serif">Hello, <br>
      <br>
      I recently started using GeoExt2. With OpenLayers, I was using
      this version of proxy.cgi : <a
href="http://trac.osgeo.org/openlayers/browser/trunk/openlayers/examples/proxy.cgi">http://trac.osgeo.org/openlayers/browser/trunk/openlayers/examples/proxy.cgi</a>.<br>
      <br>
      With GeoExt2, I encountered problems to run a WMS GetCapabilities.
      I solved it by modifying the proxy.cgi like in this post : <a
        href="http://www.geoext.org/pipermail/users/2011-May/002287.html">http://www.geoext.org/pipermail/users/2011-May/002287.html</a>.<br>
      <br>
      But with this new version of proxy.cgi, the WMSGetFeatureInfo
      query fails with the error 500 '</font>Some unexpected error
    occurred. Error text was: list index out of range'. <br>
    Actually the queried URL is URL encoded :<br>
    <br>
    <font face="Andale Mono"><a class="moz-txt-link-freetext" href="http://localhost/cgi-bin/proxy.cgi?url=http%3A%2F%2F162.38.140.226%3A8080%2Fgeoserver%2Fsf%2Fwms%3FSERVICE%3DWMS%26LAYERS%3Dsf%253Aborehole%26QUERY_LAYERS%3Dsf%253Aborehole%26STYLES%3D%26SERVICE%3DWMS%26VERSION%3D1.1.1%26REQUEST%3DGetFeatureInfo%26EXCEPTIONS%3Dapplication%252Fvnd.ogc.se_inimage%26BBOX%3D-5315418.716245%252C4750095.377026%252C5916543.966529%252C7166728.462954%26FEATURE_COUNT%3D10%26HEIGHT%3D247%26WIDTH%3D1148%26FORMAT%3Dimage%252Fpng%26INFO_FORMAT%3Dapplication%252Fvnd.ogc.gml%26SRS%3DEPSG%253A900913%26X%3D603%26Y%3D127">http://localhost/cgi-bin/proxy.cgi?url=http%3A%2F%2F162.38.140.226%3A8080%2Fgeoserver%2Fsf%2Fwms%3FSERVICE%3DWMS%26LAYERS%3Dsf%253Aborehole%26QUERY_LAYERS%3Dsf%253Aborehole%26STYLES%3D%26SERVICE%3DWMS%26VERSION%3D1.1.1%26REQUEST%3DGetFeatureInfo%26EXCEPTIONS%3Dapplication%252Fvnd.ogc.se_inimage%26BBOX%3D-5315418.716245%252C4750095.377026%252C5916543.966529%252C7166728.462954%!
 26FEATURE_
COUNT%3D10%26HEIGHT%3D247%26WIDTH%3D1148%26FORMAT%3Dimage%252Fpng%26INFO_FORMAT%3Dapplication%252Fvnd.ogc.gml%26SRS%3DEPSG%253A900913%26X%3D603%26Y%3D127</a>,
      <br>
    </font><br>
    .. while the same URL without encoding succeeds: <br>
    <br>
    <font face="Andale Mono"><big><font face="Andale Mono"><code
            role="listitem" class="focusRow subFocusRow "><a class="moz-txt-link-freetext" href="http://localhost/cgi-bin/proxy.cgi?url=http://162.38.140.226:8080/geoserver/sf/wms?SERVICE=WMS&amp;LAYERS=sf%3Aborehole&amp;QUERY_LAYERS=sf%3Aborehole">http://localhost/cgi-bin/proxy.cgi?url=http://162.38.140.226:8080/geoserver/sf/wms?SERVICE=WMS&amp;LAYERS=sf%3Aborehole&amp;QUERY_LAYERS=sf%3Aborehole</a></code><code
            role="listitem" class="focusRow subFocusRow ">&amp;STYLES=&amp;SERVICE=WMS&amp;VERSION=1.1.1&amp;REQUEST=GetFeatureInfo&amp;EXCEPTIONS=application%2Fvnd.ogc.se_inimage</code><code
            role="listitem" class="focusRow subFocusRow ">&amp;BBOX=-5315418.716245%2C4750095.377026%2C5916543.966529%2C7166728.462954&amp;FEATURE_COUNT=10&amp;HEIGHT=247</code><code
            role="listitem" class="focusRow subFocusRow ">&amp;WIDTH=1148&amp;FORMAT=image%2Fpng&amp;INFO_FORMAT=application%2Fvnd.ogc.gml&amp;SRS=EPSG%3A900913&amp;X=603&amp;Y=127</code></font><br>
      </big><br>
    </font>If I go back to the original version of&nbsp; proxy.cgi, <font
      face="Helvetica, Arial, sans-serif"> the WMSGetFeatureInfo query
      succeeds, and the </font><font face="Helvetica, Arial,
      sans-serif"> WMS GetCapabilities fails.<br>
      <br>
      Here is the beginning of my proxy.cgi file, with lines that allow
    </font><font face="Helvetica, Arial, sans-serif">WMS GetCapabilities</font>
    query to work but prevent <font face="Helvetica, Arial, sans-serif">WMSGetFeatureInfo
      query from working:<br>
      <br>
      <i>#!/usr/bin/env python</i><i><br>
      </i><i><br>
      </i><i>import urllib2</i><i><br>
      </i><i>import cgi</i><i><br>
      </i><i>import sys, os</i><i><br>
      </i><i><br>
      </i><i># Designed to prevent Open Proxy type stuff.</i><i><br>
      </i><i><br>
      </i><i>allowedHosts = ['<a class="moz-txt-link-abbreviated" href="http://www.openlayers.org">www.openlayers.org</a>', 'openlayers.org', </i><i><br>
      </i><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'labs.metacarta.com', 'world.freemap.in', </i><i><br>
      </i><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'prototype.openmnnd.org',
        'geo.openplans.org',</i><i><br>
      </i><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'sigma.openplans.org', 'demo.opengeo.org',</i><i><br>
      </i><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '<a class="moz-txt-link-abbreviated" href="http://www.openstreetmap.org">www.openstreetmap.org</a>',
        'sample.azavea.com',</i><i><br>
      </i><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'v2.suite.opengeo.org',
        'v-swe.uni-muenster.de:8080', </i><i><br>
      </i><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'vmap0.tiles.osgeo.org',
        '<a class="moz-txt-link-abbreviated" href="http://www.openrouteservice.org">www.openrouteservice.org</a>', '162.38.140.226:8080',
        'services.sandre.eaufrance.fr']</i><i><br>
      </i><i><br>
      </i><i>method = os.environ["REQUEST_METHOD"]</i><i><br>
      </i><i>qs = os.environ['QUERY_STRING']</i></font><i> </i><i><font
        face="Helvetica, Arial, sans-serif"># Added to solve problem
        with geoext and WMSgetCapabilities</font></i><i><br>
    </i><i><font face="Helvetica, Arial, sans-serif"><br>
        if method == "POST":<br>
        &nbsp;&nbsp;&nbsp; qs = os.environ["QUERY_STRING"]<br>
        &nbsp;&nbsp;&nbsp; d = cgi.parse_qs(qs)<br>
        &nbsp;&nbsp;&nbsp; if d.has_key("url"):<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; url = d["url"][0]<br>
        &nbsp;&nbsp;&nbsp; else:<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; url = <a class="moz-txt-link-rfc2396E" href="http://www.openlayers.org">"http://www.openlayers.org"</a><br>
        else:<br>
        &nbsp;&nbsp;&nbsp; fs = cgi.FieldStorage()<br>
        &nbsp;&nbsp;&nbsp; #url = fs.getvalue('url', <a class="moz-txt-link-rfc2396E" href="http://www.openlayers.org">"http://www.openlayers.org"</a>) </font></i><i><font
        face="Helvetica, Arial, sans-serif"> # Removed to solve problem
        with geoext and WMSgetCapabilities</font></i><i><br>
    </i><i><font face="Helvetica, Arial, sans-serif"><font
          face="Helvetica, Arial, sans-serif"> &nbsp;&nbsp;&nbsp; </font>url = qs[4:]
      </font></i><font face="Helvetica, Arial, sans-serif"><font
        face="Helvetica, Arial, sans-serif"><font face="Helvetica,
          Arial, sans-serif"><i># Added to solve problem with geoext and
            WMSgetCapabilities</i><br>
          <br>
          <br>
          <br>
          Would you have any idea to solve this?<br>
          <br>
          Thanks, <br>
          <br>
          Juliette<br>
        </font></font></font>
  </body>
</html>