Setting up proxy for printing

3936
5
08-27-2015 08:42 AM
LauraMiles1
Occasional Contributor III

Hi All, I'm struggling a bit to figure out how to set up the .NET proxy so I can use my print service. I believe I've set things up as they should be, but when I run my map I get an "Authentication Required" popup asking for a username and password. I don't know what u/p it's expecting as neither my Windows or ArcGIS server u/p seem to be satisfactory. My print service is not secured, nor are any other layers on the map. Does anyone know why this may be happening?

0 Kudos
5 Replies
MichaelVolz
Esteemed Contributor

Can you copy your the contents of your proxy.config to this thread?

What is esriConfig.defaults.io.proxyUrl set to in your html file?

LauraMiles1
Occasional Contributor III

Hi Michael,

My proxy.config contains:

<?xml version="1.0" encoding="utf-8" ?>

<ProxyConfig allowedReferers="http://mor"

             mustMatch="true">

    <serverUrls>

        <serverUrl url="http://cop-gis4.corp.portvancouver.com/arcgis/rest/services/MOR_Printing/GPServer/Export%20Web%20Map"

                   matchAll="true"/>

    </serverUrls>

</ProxyConfig>

http://mor is the server hosting the application, whereas http://cop-gis4.corp.portvancouver.com hosts all the map's services. I only need the print service to go through the proxy (and if I change the server url to just http://cop-gis4.corp.portvancouver.com, and matchall="false", I still get a 403 forbidden error). The rest of the services show up on the map just fine, and did so before I tried to use a proxy.

In my site's javascript, I have the line:

esriConfig.defaults.io.proxyUrl = "http://mor/mor_js_dev/DotNet/proxy.ashx";

0 Kudos
MichaelVolz
Esteemed Contributor

Can you set up the proxy temporarily to allow all traffic through by changing

<ProxyConfig allowedReferers="http://mor"

             mustMatch="true">

to

<ProxyConfig allowedReferers="*"

             mustMatch="false">

If this does not work to allow everything through, then I would use Google Chrome Developer Tools F12 to try to figure out the problem.

Also you have a folder on the IIS server (web server) that has a folder

c$\inetpub\wwwroot\mor\mor_js_dev\DotNet where the proxy files are stored?

I would move these files to a folder directly off c$\inetpub\wwwroot so it can be accessed by other HTML5/JavaScript apps.

0 Kudos
LauraMiles1
Occasional Contributor III

Hi Michael, setting the allowedReferers and mustMatch as you specified gives the same result - login box.

Yes, the folder is on the web server. mor_js_dev contains the html files etc. for the site, and in it is the DotNet folder with all the proxy files. We haven't got any other HTML5/JavaScript apps running off this web server.

I've been using Chrome Developer tools, but it's not given me much clarity. I check the console but is there anything else I should be looking at? I'm a GIS person first and not much of a developer.

If I type the proxy url that's being sent directly into the browser (DotNet/proxy.ashx?http://cop-gis4.corp.portvancouver.com/arcgis/rest/services/MOR_Printing/GPServer/Export%20Web%20Map...) I still get a login box and when I cancel that out, a 401 unauthorized error.

0 Kudos
LauraMiles1
Occasional Contributor III

Alright, I may have figured something out. If I go around my web adaptor url, I'm not getting the login box. This only happens when I use the web adaptor url. The print service is not secured though. So I'm a bit stumped why a login box is popping up. We are trying to route all services (whether secured or not) through the web adaptor as standard practice so if in future we want to secure some layers, it's just a matter of doing so in Server Manager.

0 Kudos