0

I have a proxy service (DotNet) that works great in my production environment but I can't use it in my development environment. Obviously I really need it to work in my development environment because I don't want to deploy something that doesn't work. I get 404 errors for the resource. This is how my current code sits, but I have tried a couple different things which I will explain in a minute:

<ProxyConfig allowedReferers="*"
         mustMatch="false"
         logFile="proxyLog.txt"
         logLevel="Warning">
    <serverUrls>
      <serverUrl url="https://www.mydomain.com/myserver/rest/services/HabitatManagement/HabitatManagement/GPServer"
                 username="xxx"
                 password="xxx"
                 matchAll="true"/>
      <serverUrl url="https://www.mydomain.com/myserver/rest/services/HabitatMonitoring/HabitatData/MapServer"
                 username="xxx"
                 password="xxx"
                 matchAll="true" />
      <serverUrl url="https://www.mydomain.com/myserver/rest/services/HabitatMonitoring/HabitatClassification/GPServer"
                 username="xxx"
                 password="xxx"
                 matchAll="true" />
    </serverUrls>
</ProxyConfig>

I've tried setting the allowed referrer to my specific local host like this:

<ProxyConfig allowedReferers="https://www.mydomain.com/*,"http:/localhost:14906/*"

I have also tried this:

<ProxyConfig allowedReferers="https://www.mydomain.com/*,"http:/localhost:14906/appName/*"

But that doesn't work either. I'm not really sure where to go from here.

This is an example of one of the referring URLs:

http://localhost:14906/appName/proxy/proxy.ashx?https://www.mydomain.com/myserver/rest/services/HabitatMonitoring/HabitatData/MapServer/2?f=json

1

So, I have my proxy folder under my application in Visual Studio, but when I was running it in a development environment, it was not taking the name of the application into account. I ended up having to edit the proxyUrl property in my JS code to remove the appName and it started working.

Originally I had this:

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

After the fix it became this:

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

It worked with this code in proxy config:

<ProxyConfig allowedReferers="*"
     mustMatch="true"
     logFile="proxyLog.txt"
     logLevel="Warning">
<serverUrls>
  <serverUrl url="https://www.mydomain.com/myserver/rest/services/HabitatManagement/HabitatManagement/GPServer"
             username="xxx"
             password="xxx"
             matchAll="true"/>
  <serverUrl url="https://www.mydomain.com/myserver/rest/services/HabitatMonitoring/HabitatData/MapServer"
             username="xxx"
             password="xxx"
             matchAll="true" />
  <serverUrl url="https://www.mydomain.com/myserver/rest/services/HabitatMonitoring/HabitatClassification/GPServer"
             username="xxx"
             password="xxx"
             matchAll="true" />
</serverUrls>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.