I use Geoserver 2.8.1, Openlayers 2.12, GeoExt 1.1 on a Windows machine. I can successfully print a map using the Print Provider below:
var printProvider = new GeoExt.data.PrintProvider({
method: "GET", // "POST" recommended for production use
capabilities: printCapabilities,
customParams: {
mapTitle: mapTitle,
comment: mapNote
}
});
In the previous example the "printCapabilities" variable points to this location and everything works fine;
http://99.99.99.99:8080/geoserver/pdf/info.json?var=printCapabilities
I have large complicated maps with many layers and using the "GET" option my print map requests frequently exceed the maximum request length and return an error.
I know I can change "GET" to "POST" in order to send longer map print requests. If I change my Print Provider to the following;
var printProvider = new GeoExt.data.PrintProvider({
url: "/geoserver/pdf",
autoLoad: true,
method: 'POST',
customParams: {
mapTitle: mapTitle,
comment: mapNote
}
});
my print fails and FireBug gives me the following error explanation;
"XMLHttpRequest cannot load http://99.99.99.99:8080/geoserver/pdf/info.json. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://99.99.99.99' is therefore not allowed access."
I already have an OpenLayers proxy setup as follows:
OpenLayers.ProxyHost = "/proxy.ashx?url=";
and I use the "URL-Rewrite" tool in Microsofts Internet Information Services (IIS) manager to redirect any URL's and avoid the same origin problem. It works for everything else but for some reason the POST option makes the server think that I am violating the same origin policy.
What do I have to do to make my system recognize that the print request is coming from the same server as everything else?