<html>
<head>
<meta name="generator" content="Windows Mail 17.5.9600.20498">
<style data-externalstyle="true"><!--
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph {
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:.5in;
margin-bottom:.0001pt;
}
p.MsoNormal, li.MsoNormal, div.MsoNormal {
margin:0in;
margin-bottom:.0001pt;
}
p.MsoListParagraphCxSpFirst, li.MsoListParagraphCxSpFirst, div.MsoListParagraphCxSpFirst, 
p.MsoListParagraphCxSpMiddle, li.MsoListParagraphCxSpMiddle, div.MsoListParagraphCxSpMiddle, 
p.MsoListParagraphCxSpLast, li.MsoListParagraphCxSpLast, div.MsoListParagraphCxSpLast {
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:.5in;
margin-bottom:.0001pt;
line-height:115%;
}
--></style></head>
<body dir="ltr">
<div data-externalstyle="false" dir="ltr" style="font-family: 'Calibri', 'Segoe UI', 'Meiryo', 'Microsoft YaHei UI', 'Microsoft JhengHei UI', 'Malgun Gothic', 'sans-serif';font-size:12pt;"><div>Hello,</div><div><br></div><div style="margin-right: 0px;" dir="ltr">I’ve been able to use OpenLayers to reference a KML file on the same server as my OpenLayers script, inside an HTML file, but once have it pointing to a WFS service on a GeoServer that references a PostGIS table, it gives me the FireFox/FireBug error:</div><div style="margin-right: 0px;" dir="ltr"><br></div><div style="margin-right: 0px;" dir="ltr"><span class="objectBox objectBox-errorMessage " role="presentation"><span class="errorMessage ">“Cross-Origin
 Request Blocked: The Same Origin Policy disallows reading the remote 
resource at https://192.168.0.128:6443/geoserver/turner/wfs. This can be
 fixed by moving the resource to the same domain or enabling CORS.”</span></span></div><div style="margin-right: 0px;" dir="ltr"><span class="objectBox objectBox-errorMessage " role="presentation"><span class="errorMessage "></span></span><br></div><div style="margin-right: 0px;" dir="ltr"><span class="objectBox objectBox-errorMessage " role="presentation"><span class="errorMessage ">Interesting thing is it is all, in fact, on the same server (all same IP).  But the HTML/OpenLayers file is served up via Apache2 on port 443, and the GeoServer is on Tomcat’s port 6443.  But it will be on different servers eventually, so regardless I need to get this working.  Can anyone help?</span></span></div><div style="margin-right: 0px;" dir="ltr"><span class="objectBox objectBox-errorMessage " role="presentation"><span class="errorMessage "></span></span><br></div><div style="margin-right: 0px;" dir="ltr"><span class="objectBox objectBox-errorMessage " role="presentation"><span class="errorMessage ">I’m a GIS guy, not a web guy (yet), not a PHP guy, so I’ve seen some solutions suggesting a PHP proxy, but I don’t understand that, and I’d rather do it all in JS since I’m already using that for OpenLayers and supposedly it can all work through JS.</span></span></div><div style="margin-right: 0px;" dir="ltr"><span class="objectBox objectBox-errorMessage " role="presentation"><span class="errorMessage "></span></span><br></div><div style="margin-right: 0px;" dir="ltr"><span class="objectBox objectBox-errorMessage " role="presentation"><span class="errorMessage ">Here’s the stuff in my OpenLayers HTML file called earlyvoting2.html:</span></span></div><div style="margin-right: 0px;" dir="ltr"><span class="objectBox objectBox-errorMessage " role="presentation"><span class="errorMessage "></span></span><br></div><div style="margin-right: 0px;" dir="ltr"><span class="objectBox objectBox-errorMessage " role="presentation"><span class="errorMessage ">var earlyabsentee_wfs = new OpenLayers.Layer.Vector("Early Voting",{<br>     strategies: [new OpenLayers.Strategy.Fixed()],<br>     projection: map.displayProjection,<br>     protocol: new OpenLayers.Protocol.WFS({<br>      version: "1.1.0",<br>      srsName: "EPSG:4326",<br>      url: "<a href="https://192.168.0.128:6443/geoserver/turner/wfs" target="_parent">https://192.168.0.128:6443/geoserver/turner/wfs</a>",<br>      featureNS: "<a href="https://192.168.0.128:6443/geoserver/turner" target="_parent">https://192.168.0.128:6443/geoserver/turner</a>",<br>      featureType: "brown:earlyabsentee",<br>     })</span></span></div><div style="margin-right: 0px;" dir="ltr"><span class="objectBox objectBox-errorMessage " role="presentation"><span class="errorMessage "></span></span><span class="objectBox objectBox-errorMessage " role="presentation"><span class="errorMessage ">});</span></span></div><div style="margin-right: 0px;" dir="ltr"><span class="objectBox objectBox-errorMessage " role="presentation"><span class="errorMessage "></span></span><br></div><div style="margin-right: 0px;" dir="ltr"><span class="objectBox objectBox-errorMessage " role="presentation"><span class="errorMessage ">I’m using IP’s because I haven’t bought a static IP certificate yet, but for purposes of this post let’s say in my intranet 192.168.0.128 is an Ubuntu 14.04 server named Turner, and everything is on it (PostGIS, Apache2, Tomcat, GeoServer, etc.).</span></span></div><div style="margin-right: 0px;" dir="ltr"><span class="objectBox objectBox-errorMessage " role="presentation"><span class="errorMessage "></span></span><br></div><div style="margin-right: 0px;" dir="ltr"><span class="objectBox objectBox-errorMessage " role="presentation"><span class="errorMessage ">I don’t quite understand, since I can bring the same layer in as a WMS link in a stubbed out OpenLayers page with one layer from the Layer Preview page in GeoServer, so it does CORS there.  But it hates WFS.</span></span></div><div style="margin-right: 0px;" dir="ltr"><span class="objectBox objectBox-errorMessage " role="presentation"><span class="errorMessage "></span></span><br></div><div style="margin-right: 0px;" dir="ltr"><span class="objectBox objectBox-errorMessage " role="presentation"><span class="errorMessage ">     -Zack Stauber</span></span></div><div style="margin-right: 0px;" dir="ltr"><span class="objectBox objectBox-errorMessage " role="presentation"><span class="errorMessage "></span></span><br></div></div>
</body>
</html>