CORS error on Print

566
2
Jump to solution
11-24-2022 05:33 AM
AdrianMarsden
Occasional Contributor III

CORS yet again - totally fed up now with this.

I HAVE to use API 3.11 - see Re: Measure Tool no longer gives result on mouse M... - Esri Community  due to a bug in the measure tool.

We are migrating to a new server so having fun with CORS, yet again.

Everything works until I try to print.  Then I get 

esri.config.defaults.io.proxyUrl is not set. If making a request to a CORS enabled server, please push the domain into esri.config.defaults.io.corsEnabledServers

No hint as to WHAT domain needs pushing.

This works if I go to the latest 3.x api.

So, I listed out what is in corsEnabledServers in the latest api and compared with what I had in 3.11 and pushed all the others in.  Still nothing.  Although I couldn't work out how to push '/^https?:\/\/.+\.arcgis\.com(\/|$)/i, ' which is present in the latest version.

Any ideas?

Cheers


ACM

 

 

0 Kudos
1 Solution

Accepted Solutions
AdrianMarsden
Occasional Contributor III

OK - sorted - sort of.

I asked myself what was different the second time around?  I even trapped the error, and in error routine called the print service again (this didn't work) but when I added a console.log(esri.config.defaults.io.corsEnabledServers) when the print function was called the second time it had one extra site in it - and this was the crucial one, in my case it was gisserver.fully.qualifed:6443 - pushing that in at startup sorts stuff

 

View solution in original post

0 Kudos
2 Replies
AdrianMarsden
Occasional Contributor III

Oh - and to make this even more annoying this error only happens the FIRST time I make a request to the CustomPrint service - if I try a second time it is fine!

0 Kudos
AdrianMarsden
Occasional Contributor III

OK - sorted - sort of.

I asked myself what was different the second time around?  I even trapped the error, and in error routine called the print service again (this didn't work) but when I added a console.log(esri.config.defaults.io.corsEnabledServers) when the print function was called the second time it had one extra site in it - and this was the crucial one, in my case it was gisserver.fully.qualifed:6443 - pushing that in at startup sorts stuff

 

0 Kudos