AnsweredAssumed Answered

Anybody successfully set up a proxy for a geoprocessing service involving file upload?

Question asked by MollyKFoley on Oct 24, 2018

I have set up a proxy so my services can be secured and users don't need to login to the application, it just authenticates in the background with a token (users log into an application that the javascript api map sits inside of, so no need to log in again). The map server services work great, my data shows up as it should and everything works as expected. However, I cannot get my geoprocessing services to upload files because the input parameters (i.e. job ID) change with every submission so I don't know how to get the serverUrls in the proxy.config file to match. The documentation for the proxy settings in the config file also contradicts itself:

  • url: Location of the ArcGIS Server service (or other URL) to proxy. Specify either the specific URL or the root (in which case you should set matchAll="false").
  • matchAll="true": When true all requests that begin with the specified URL are forwarded. Otherwise, the URL requested must match exactly.

 

I would assume if it's the root URL you'd want to set matchAll to true so it'll match anything after the root. The "url" setting says the opposite what the matchAll setting says... either way, I've tried setting matchAll to both true and false and neither work. I still get errors like this in the console when trying to submit my file for upload to my GP service:

{"error": {"code": 403,"message":"Proxy has not been set up for this URL. Make sure there is a serverUrl in the configuration file that matches: https://www.mydomain.com/myServer/rest/services/HabitatManagement/HabitatManagement/GPServer/HabitatManagement/submitJob?f=json&Input_Zip_File=%7B%22itemID%22%3A%22i5d997ada-4aa9-4a68-8321-1170446ed463%22%7D&State_Abbreviation=PA&Email_Address=xxx%40xxx.xxx

 

Current JS code:

urlUtils.addProxyRule({
                urlPrefix: "https://www.mydomain.com",
                proxyUrl: "/appName/proxy/proxy.ashx"
            });

 

Current proxy.config file:

<ProxyConfig allowedReferers="https://www.mydomain.com/*"
             mustMatch="true"
             logFile="proxyLog.txt"
             logLevel="Warning">

    <serverUrls>
      <serverUrl url="https://www.mydomain.com/myServer/rest/services/HabitatManagement/GPServer/uploads/upload"
                 username="username"
                 password="password"
                 matchAll="true"/>

      <serverUrl url="https://www.mydomain.com/myServer/rest/services/HabitatMonitoring/HabitatData/MapServer"
                 username="username"
                 password="password"
                 matchAll="true" />

      <serverUrl url="https://www.mydomain.com/myServer/rest/services/HabitatMonitoring/HabitatClassification/GPServer/uploads/upload"
                 username="username"
                 password="password"
                 matchAll="true" />

    </serverUrls>
</ProxyConfig>

Outcomes