Hi,

I'm trying to generate a pdf file to print a map using GeoExt but have run
into a problem. On Chrome I get the error message:

XMLHttpRequest cannot load http://Howard:8080/geoserver/pdf/create.json.
Origin http://localhost:55608 is not allowed by Access-Control-Allow-Origin.

I think the error message tells me that its to do with the proxy so I have
tried adding the following to the Config.yaml but not luck:

- !localMatch
  dummy: true
- !ipMatch
  host: 0.0.0.0
  mask: 0.0.0.0

This should have allowed all local ip addresses and all hosts to access the
create.json in Howard:8080 but for some reason I still get the error
message.

However, on Firefox I get a slighly different behaviour. I dont get any
error message but I end up triggering a printexception with an error message
"Communication failure.

I'm stuck and out of ideas, can anyone help?

Here is the code:

var printProvider =  new GeoExt.data.PrintProvider({
              //method: "GET", // "POST" recommended for production use
              method: "POST", // "POST" recommended for production use

              //capabilities: g_printCapabilities,  // provide url instead
for lazy loading

              url: OpenLayers.ProxyHost +
"http://Howard:8080/geoserver/pdf/";,
              //url: "http://Howard:8080/geoserver/pdf/";,
              autoLoad: true,

              customParams: {
                mapTitle: "GeoExt Printing Demo",
                comment: "This demo shows how to use GeoExt.PrintMapPanel
with OSM"
              }
          });


var printPage = new GeoExt.data.PrintPage({
    printProvider: printProvider
});

var mapPanel = new GeoExt.MapPanel({
    title: "Map",
    region: "center",
    height: 400,
    width: 600,
    map: map,

    bbar: ["->", {
        text: "Print",
        handler: function() {
            // convenient way to fit the print page to the visible map area
            printPage.fit(mapPanel, true);

            printProvider.print(mapPanel, printPage);
        }
    }]
});

// create a panel and add the map panel and grid panel
// inside it
var mainPanel = new Ext.Panel({
    renderTo: "mainpanel",
    layout: "border",
    height: 800,
    width: 600,
    items: [mapPanel]
});

--
View this message in context: 
http://osgeo-org.1560.n6.nabble.com/GeoExt-PDF-printing-Error-message-Origin-http-localhost-55608-is-not-allowed-by-Access-Control-Allow-tp4912904p4912904.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to