[GIS] CORS Printing Issue with ArcGIS Javascript

arcgis-javascript-apiarcgis-servercors

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("10.111.123.234:6080");
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?

Best Answer

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.

Related Question