<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: javascript Print Secured Service in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-print-secured-service/m-p/696336#M64851</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I wonder if you hit this bug&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://support.esri.com/en/bugs/nimbus/role/beta10_1/TklNMDk0NDMx"&gt;http://support.esri.com/en/bugs/nimbus/role/beta10_1/TklNMDk0NDMx&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 27 May 2014 16:27:46 GMT</pubDate>
    <dc:creator>JeffPace</dc:creator>
    <dc:date>2014-05-27T16:27:46Z</dc:date>
    <item>
      <title>javascript Print Secured Service</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-print-secured-service/m-p/696335#M64850</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This seems to be a popular question, but with few answers.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a intranet website that uses one secured service in a directory called Secure. All services in this directory have been secured and show up as map services using a proxy as anticipated.&amp;nbsp; The problem comes with the printing.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have followed the directions as described on this website:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#/Printing_maps_that_contain_secured_services/0154000005q3000000/" rel="nofollow noopener noreferrer" target="_blank"&gt;http://resources.arcgis.com/en/help/main/10.2/index.html#/Printing_maps_that_contain_secured_services/0154000005q3000000/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have put the secured ExportWebMapSecure service in the Secure directory mentioned above. (I have also tried it in my customized public utilities, with no more success.) &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It doesn't work.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Couple of questions:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1) What is the proper way to call the proxy for the print.js?&amp;nbsp; I have tried two ways:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;A:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
 urlUtils.addProxyRule({
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; urlPrefix: "http://server_for_gis/arcgis/rest/services/Secure",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; proxyUrl: "http://server_for_web/apps/gis/Proxy/proxy.ashx"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;B: &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
esriConfig.defaults.io.proxyUrl = "http://server_for_web/apps/gis/Proxy/proxy.ashx";
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2) If I were to test the&amp;nbsp; service directly using JSON,&amp;nbsp; how do I include the proxy?&amp;nbsp; On this page:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#/ExportWebMap_specification/02r3000001mz000000/" rel="nofollow noopener noreferrer" target="_blank"&gt;http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#/ExportWebMap_specification/02r3000001mz000000/&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;It doesn't mention the proxy. It only has the token. So it's not very helpful to test the proxy.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
"operationalLayers": [
{
&amp;nbsp; "id" : "mytheme",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "opacity": 1,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "visibility": true,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "url": "http://server_for_gis/arcgis/rest/services/Secure/mytheme/MapServer"
}]
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;3)&amp;nbsp; The error message I get right now is this. Even when there isn't any secured services being called. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
http://server_for_web/apps/gis/Proxy/proxy.ashx?http://server_for_gis/arcgis/rest/services/Secure/ExportWebMapSecure/GPServer/Export%20Web%20Map?f=json status: 500"

&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is using the following in my print.js:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
 urlUtils.addProxyRule({
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; urlPrefix: "http://server_for_gis/arcgis/rest/services/Secure",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; proxyUrl: "http://server_for_web/apps/gis/Proxy/proxy.ashx"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;4) Should the ExportWebMap be in the Secure directory?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you in advance for any clarification you can make.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Dorothy&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:18:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-print-secured-service/m-p/696335#M64850</guid>
      <dc:creator>DorothyMortenson</dc:creator>
      <dc:date>2021-12-12T05:18:53Z</dc:date>
    </item>
    <item>
      <title>Re: javascript Print Secured Service</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-print-secured-service/m-p/696336#M64851</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I wonder if you hit this bug&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://support.esri.com/en/bugs/nimbus/role/beta10_1/TklNMDk0NDMx"&gt;http://support.esri.com/en/bugs/nimbus/role/beta10_1/TklNMDk0NDMx&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 May 2014 16:27:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-print-secured-service/m-p/696336#M64851</guid>
      <dc:creator>JeffPace</dc:creator>
      <dc:date>2014-05-27T16:27:46Z</dc:date>
    </item>
    <item>
      <title>Re: javascript Print Secured Service</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-print-secured-service/m-p/696337#M64852</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I wonder also.&amp;nbsp; FYI for others, here's the message:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Synopsis&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;A custom print service with saved credentials created from the Export Web Map task fails to print individual feature layers from a secured map service.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is unfortunate, if this is the case.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 May 2014 18:06:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-print-secured-service/m-p/696337#M64852</guid>
      <dc:creator>DorothyMortenson</dc:creator>
      <dc:date>2014-05-27T18:06:42Z</dc:date>
    </item>
    <item>
      <title>Re: javascript Print Secured Service</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-print-secured-service/m-p/696338#M64853</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I wonder if anyone can answer some of the other questions so I could continue to do some testing. (#1, 2, and 4)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Dorothy&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 May 2014 18:09:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-print-secured-service/m-p/696338#M64853</guid>
      <dc:creator>DorothyMortenson</dc:creator>
      <dc:date>2014-05-27T18:09:26Z</dc:date>
    </item>
    <item>
      <title>Re: javascript Print Secured Service</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-print-secured-service/m-p/696339#M64854</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;FYI, the updated url is:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://support.esri.com/en/bugs/nimbus/TklNMDk0NDMx"&gt;http://support.esri.com/en/bugs/nimbus/TklNMDk0NDMx&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Been several months, but no apparent action.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Dorothy&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jun 2014 21:21:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-print-secured-service/m-p/696339#M64854</guid>
      <dc:creator>DorothyMortenson</dc:creator>
      <dc:date>2014-06-10T21:21:54Z</dc:date>
    </item>
    <item>
      <title>Re: javascript Print Secured Service</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-print-secured-service/m-p/696340#M64855</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dorothy....long time no talk.&amp;nbsp; As you mentioned, there are many with questions re: printing secure services with Javascript.&amp;nbsp;&amp;nbsp; I was able to solve this issue a while back if my html was on the same server/website and I had my proxy set up.&amp;nbsp; My issue came about because an html will now located on a "remove" webserver.&amp;nbsp; It took some head scratching and a bit of time with a tech support analyst, but I finally got mine to work.&amp;nbsp; I may try to type this up as a blog entry, but for now, I wanted to get this out there for others to try.&amp;nbsp; If it works for you, please mark as solved...if not and it's all on one server, email me direct (same old email) and we can talk.&amp;nbsp; Hopefully with all my buzz words in my response, others can find it.&amp;nbsp; My guess is the solution will work for both JS and Flex (with the appropriate proxy).&amp;nbsp; My response:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;A Fix for printing secure services from remote machine&lt;/STRONG&gt;.&amp;nbsp; This solves errors such as &lt;/P&gt;&lt;UL style="list-style-type: disc;"&gt;&lt;LI&gt;- XMLHttpRequest cannot load&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;- No&amp;nbsp; 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://" rel="nofollow" target="_blank"&gt;http://&lt;/A&gt;&lt;SPAN&gt;&amp;lt;yourServer&amp;gt;' is therefore not allowed access&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My simple understanding and explanation of the solution: Basically I needed to reference a proxy in the two locations (IIS servers).&amp;nbsp; The secured services need to have the proxy (as an iis app) on the IIS server with the ArcGIS Server web adapters (i.e., within my AGS site);&amp;nbsp; The print service on the other hand needs to have the proxy (as an iis app) on the iis server where the web site is hosted.&amp;nbsp; The JS/HTML file needs to reference them both in their own way.&lt;/P&gt;&lt;P&gt;My setup:&lt;/P&gt;&lt;UL style="list-style-type: disc;"&gt;&lt;LI&gt;- ArcGIS Server 10.2.2&amp;nbsp; (my guess is this will work for other versions too) &lt;UL style="list-style-type: circle;"&gt;&lt;LI&gt;Web adaptors on separate server (IIS), one for public services, one for secure.&amp;nbsp; &lt;/LI&gt;&lt;LI&gt;Proxy setup on IIS machine with web adaptors and working.&amp;nbsp; &lt;/LI&gt;&lt;LI&gt;Default Print Service is running as non-secure/public (default).&amp;nbsp; I have added custom templates to the folder and restarted the service.&amp;nbsp; &lt;/LI&gt;&lt;LI&gt;I have all working on with my JavaScript (HTML file) web site if it is running on the same IIS site mention above.&amp;nbsp; I even have a query and zoom on a secure FeatureLayer&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;- Problem: when same HTML file is copied to a different web site or IIS server, I get CORS and Access-Control errors. &lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That is, when attempting to print a map that contains secure services from a remote web server,&amp;nbsp;&amp;nbsp; using the ArcGIS Server "Export Web Map Task" service (default or custom), if you get an error re: CORS or "No 'Access-Control-Allow-Origin' header is present", try the following:&lt;/P&gt;&lt;P&gt;(This assumes: that you already have a proxy setup and working to access your secure services. In my case, it is located in the IIS site where my web adapters are located.)&lt;/P&gt;&lt;P&gt;NOTE: Remote machine refers to the website IIS server &lt;/P&gt;&lt;OL style="list-style-type: decimal;"&gt;&lt;LI&gt;On the remote machine, set-up (copy) a new proxy in the IIS site where the web site is located (this may be the “c:\inetpub\wwwroot” folder or a different location if multiple websites).&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;OL style="list-style-type: lower-alpha;"&gt;&lt;LI&gt; This can be a “blank” proxy folder.&amp;nbsp; For my testing purposes, I called the folder “printProxy”.&amp;nbsp; I am using the old esri proxy format, but I assume the latest esri proxy version would also work.&amp;nbsp; I have&amp;nbsp; attached a zipped copy of the folder for those that need it.&lt;/LI&gt;&lt;LI&gt;If you already have a proxy on this machine, you might be able to skip this portion, and just reference the existing proxy (I haven’t tested this)&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;LI&gt;Using IIS Manager, right click on the “printProxy” folder and select “Convert to Application”&lt;/LI&gt;&lt;LI&gt;In the JS html document (shown using AMD), add&amp;nbsp; the &lt;SPAN style="color: #e23d39;"&gt;red&lt;/SPAN&gt; text to the appropriate location &lt;BR /&gt; &lt;/LI&gt;&lt;/OL&gt;&lt;P style="margin-left: 1in;"&gt;require ( [….,&lt;/P&gt;&lt;P style="margin-left: 1in;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: red;"&gt;“esri/urlUtils”,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-left: 1in;"&gt;…],&lt;/P&gt;&lt;P style="margin-left: 1in;"&gt;function (… ,&lt;/P&gt;&lt;P style="margin-left: 1in;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: red;"&gt;urlUtils,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-left: 1in;"&gt;… ) {&lt;BR /&gt; &lt;/P&gt;&lt;P&gt;These are case sensitive.&amp;nbsp; Make sure to include the comma where needed and to match the order of the entry between the require and function sections.&amp;nbsp;&amp;nbsp; I can elaborate on the other require/function I have in my code if needed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;Then add (I add it after&amp;nbsp;&amp;nbsp;&amp;nbsp; parser.parse();&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;BR /&gt;&lt;SPAN style="color: #2873ee;"&gt; urlUtils.addProxyRule({&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="color: #2873ee;"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; urlPrefix: "&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://" rel="nofollow" target="_blank"&gt;https://&lt;/A&gt;&lt;SPAN&gt;&amp;lt;youGISiisServer&amp;gt;/&amp;lt;yourWebAdaptor&amp;gt;"",&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="color: #2873ee;"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; proxyUrl: "&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://" rel="nofollow" target="_blank"&gt;https://&lt;/A&gt;&lt;SPAN&gt;&amp;lt;youGISiisServer&amp;gt;/&amp;lt;yourProxyFolderOnThatMachine&amp;gt;/proxy.ashx"}); &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="color: #2873ee;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="color: #2873ee;"&gt;&amp;nbsp; // Proxy and CORS options for printing secure services from remote machines&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="color: #2873ee;"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; esriConfig.defaults.io.proxyUrl = "&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://" rel="nofollow" target="_blank"&gt;http://&lt;/A&gt;&lt;SPAN&gt;&amp;lt;remoteIISMachine&amp;gt;/printProxy/proxy.ashx";&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="color: #2873ee;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; esriConfig.defaults.io.alwaysUseProxy = false;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="color: #e23d39;"&gt;&lt;SPAN style="color: #2873ee;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; esriConfig.defaults.io.corsDetection = false;&amp;nbsp; &lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Make sure to change the references to your own machines and web adaptor.&amp;nbsp; In the sample above, the&amp;nbsp; &lt;STRONG&gt;urlUtils.addProxyRule&lt;/STRONG&gt; points to the proxy on you ArcGIS Server IIS machine.&amp;nbsp; The &lt;STRONG&gt;esriConfig.defaults.io.proxyUrl&lt;/STRONG&gt; points to the print proxy on your non-ArcGIS Server (i.e. remote) web site.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this helps you and/or others.&amp;nbsp; Let me know if somethings doesn't make sense.&amp;nbsp; It would be nice to make the steps a bit easier to read. &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/shocked.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Oct 2014 04:07:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-print-secured-service/m-p/696340#M64855</guid>
      <dc:creator>RebeccaStrauch__GISP</dc:creator>
      <dc:date>2014-10-23T04:07:23Z</dc:date>
    </item>
    <item>
      <title>Re: javascript Print Secured Service</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-print-secured-service/m-p/696341#M64856</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The NIM does mention it is fixed in 10.3, but there are a few other issues that will still be encountered if you want to print to a secure service. I'm using an older version of the proxy and there is a small issue there as well (not sure if fixed in latest .NET proxy) although a small change there, and/or change the timeout settings for the service to be less than token time if custom print.&lt;/P&gt;&lt;P&gt;Here is a summary of a few workarounds: &lt;A class="link-titled" href="http://www.spatialtimes.com/2015/04/printing-with-arcgis-for-server-10-3/" title="http://www.spatialtimes.com/2015/04/printing-with-arcgis-for-server-10-3/"&gt;Printing with ArcGIS for Server 10.3 - Spatial Times&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 10 Mar 2018 18:44:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-print-secured-service/m-p/696341#M64856</guid>
      <dc:creator>BryanMc</dc:creator>
      <dc:date>2018-03-10T18:44:21Z</dc:date>
    </item>
    <item>
      <title>Re: javascript Print Secured Service</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-print-secured-service/m-p/1225119#M79112</link>
      <description>&lt;P&gt;This is my solution for working on ArcGIS Enterprise portal when dealing directly with JSON.&lt;/P&gt;&lt;P&gt;I had a published a geoprocessing service coded in python that directly access the generateToken service to create a short-term token for the particular secure service layer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;generateToken&lt;/P&gt;&lt;LI-CODE lang="c"&gt;https://&amp;lt;portal domain&amp;gt;/portal/sharing/rest/generateToken&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The parameter for the generateToken service looks like this&lt;/P&gt;&lt;LI-CODE lang="c"&gt;params = {
    'username': &amp;lt;username&amp;gt;,
    'password': &amp;lt;password&amp;gt;,
    'client': 'referer',
    'referer': &amp;lt;secure service layer URL&amp;gt;,
    'expiration': 1
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When you execute a http request, you should get back a token. You need to do this for every secure service layer that you want to include into your operationalLayer&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then, in your operationLayer section, for each layer definition object, add parameter&lt;/P&gt;&lt;LI-CODE lang="c"&gt;token: &amp;lt;generateToken&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One thing to keep in mind is that there is a character limit on how long you can make you&amp;nbsp;&lt;SPAN&gt;Web_Map_as_JSON.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So I don't imagine you can add a lot of layer with this method due to the long token string.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2022 11:53:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-print-secured-service/m-p/1225119#M79112</guid>
      <dc:creator>gpei_ahuang</dc:creator>
      <dc:date>2022-10-25T11:53:30Z</dc:date>
    </item>
  </channel>
</rss>

