I'm developing an application using the ArcGIS Javascript API and everything has been working fine until I've tried to incorporate the print widget using printtask. When only the base layers are accessed in the code, the map is printed just fine. But when I include any layer running on my local instance of ArcGIS Server 10.2 (dynamic or feature layers) the print operation fails. I assume this is because I need a "proxy" file although I thought I read it's possible to utilize CORS. I'm using the latest FireFox browser, ArcGIS Server 10.2 and I have configured my code to include:
esri.config.defaults.io.corsEnabledServers.push(""); esri.config.defaults.io.corsEnabledServers.push("sampleserver1a.arcgisonline.com"); esri.config.defaults.io.corsEnabledServers.push("sampleserver6.arcgisonline.com"); esri.config.defaults.io.corsEnabledServers.push("tasks.arcgisonline.com"); esri.config.defaults.io.corsEnabledServers.push("server.arcgisonline.com");

The IP address above is my local PC pointing to the ArcGIS Server port of my services. I have tried just localhost:6080 as well.

Either way, the printing functionality still fails so I'm not sure if CORS is valid for this operation and that I have to use a proxy file anyway?

  • 1
    The idea of the proxy in this case would be to make it appear to the JavaScript on your localhost server that the content of the arcgisonline.com servers was also being served from the localhost server. This would get over the cross origin resources issue.
    – nmtoken
    Mar 20 '14 at 16:23
  • Hmmm...there isn't a problem loading and printing the basemaps from the arcgisonline.com servers. It seems to be a problem printing the local services on my local install of ArcGIS Server. When I comment out the code so that my local services are not loaded, the printing of arcgisonline basemaps works fine. Otherwise, I get an error when I try to print.
    – Dan
    Mar 20 '14 at 16:55
  • What's the error message?
    – nmtoken
    Mar 20 '14 at 17:46
  • 1
    I think the issue may be limited to just my ArcGISDynamicMapService. I have two ArcGISDynamicMapServices which include several layers in each service. And I also have four feature layer services. I noticed that the feature layer services do print correctly unless it's zoomed out too far and I get a timeout error. However the ArcGISDynamicMapServices won't work at all and the error is not a timeout error but a vague "Error: Unable to complete operation."
    – Dan
    Mar 20 '14 at 18:12

This is a java-script running in a web browser issue. Web browsers can only send requests over port 80 or 443. Which are http and https.

So sending a request to port 6080 will not work.

I would just setup the ArcGIS Web Adaptor on your local. That acts as a software proxy.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.