// Here's is how I did this. <br><br>// You need to use the openlayers proxy:<br><br> OpenLayers.ProxyHost="proxy.cgi?url=";<br><br>// WFS layer points to geoserver or your host<br><br> state_layer = new OpenLayers.Layer.WFS( "States WFS",<br>
"<a href="http://yourhost:8080/geoserver/wfs">http://yourhost:8080/geoserver/wfs</a>",<br> { typename: 'topp:states'} );<br><br>===============<br><br>I'm using rails, so I create a sort of fake proxy in config/routes.rb<br>
<br> map.connect '/proxy.cgi',<br> :controller => 'wfs',<br> :action => 'myproxy'<br><br>Then inside the myproxy() action:<br><br>if url =~ /geoserver/<br> # geo server WFS data<br>
uri = URI.parse(url)<br> resp = Net::HTTP.get_response(uri)<br> send_data(resp.body, :type => 'text/xml')<br> end<br>