AnsweredAssumed Answered

Proxy problems

Question asked by MollyKFoley on Oct 23, 2018
Latest reply on Oct 25, 2018 by MollyKFoley

I'm quite confused on how to get this proxy working. 

 

I've secured one geoprocessing service called Habitat Management. It is located in the HabitatManagement folder, the service is titled HabitatManagement, and it contains a geoprocessing task called HabitatManagement. Essentially, the url for the secured service looks like this:

https://www.mydomain.com/myServer/rest/services/HabitatManagement/HabitatManagement/GPServer/HabitatManagement

 

The actual web mapping application resides inside of a .NET application. The URL of the .NET application is this:

https://www.mydomain.com/appName

 

The actual web map url is this:

https://www.mydomain.com/appName/HabitatMap/HabitatJSMap

 

I have my proxy config file set up like so:

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

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

    </serverUrls>
</ProxyConfig>

 

I have the proxy JS code like this:

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

 

If I go to the proxy page following this URL:

https://www.mydomain.com/appName/proxy/proxy.ashx

It works as expected, it says "Config File: "OK" Log File: "OK""

 

When I test this URL, it takes me to the HabitatManagement folder but does not show the services within it, even though the token should be passing the username and password so I can see the services, right? That's issue #1 that I don't understand.

https://www.mydomain.com/appName/proxy/proxy.ashx?https://www.mydomain.com/myServer/rest/services/HabitatManagement

 

Additionally, when I go the web map and try to access the service, it still makes me login with this message:

Please sign in to access the item on https://www.mydomain.com/myServer (HabitatManagement/HabitatManagement)

If I login, things work fine - it appears the token is generated and appended to the URL as it should be.

 

If I change the config file serverURL to this (note the extra "HabitatManagement" on the end of the URL):

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

and try this URL, the request fails with "Bad Request" error:

https://www.mydomain.com/appName/proxy/proxy.ashx?https://www.mydomain.com/myServer/rest/services/HabitatManagement/HabitatManagement

and if I test it in the application it still prompts me to login with the same message as before.

 

I have also tried to change my serverURL to something very general with no luck. Ideally, the serverURL would be more specific than this as there are some services we have that don't require authentication thus do not need to run through a proxy.

<serverUrl url="https://www.mydomain.com"
                  username="username"
                  password="password"
                  matchAll="true"/>

 

I'm not sure if my proxy is located in the wrong spot, or if my referrer URL is messed up, or if my serverURLs are messed up. How do I access my secured services using the proxy?

Outcomes