.NET proxy url duplicate

2337
5
Jump to solution
02-01-2016 11:43 AM
KhanhPham1
New Contributor II

Could someone point in the right direction as to why the proxy duplicate the url:

https://localhost/proxy/proxy.ashx?https://localhost/proxy/proxy.ashx?https://services.arcgisonline....

Capture1.PNG

Capture.PNG

This is my proxy.ashx

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

<ProxyConfig allowedReferers="*" logFile="proxylog.txt"

             mustMatch="false">

    <serverUrls>     

        <serverUrl url="https://services.arcgisonline.com"

                   matchAll="true"/>       

        <serverUrl url="https://server.arcgisonline.com"       

                   matchAll="true"/>      

    </serverUrls>

</ProxyConfig>

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
KhanhPham1
New Contributor II

For others that might have the same problem.  I solved it but not sure if it's best practice.

esriConfig.defaults.io.proxyUrl //removed

esriConfig.defaults.io.alwaysUseProxy = false;

urlUtils.addProxyRule({

        proxyUrl: "https://xxxx/proxy/proxy.ashx",

        urlPrefix: "https://xxx/arcgis/rest/services/xxxx/xxxx/MapServer",

        accessToken: "1xxxxxxxxxxxxxxasdfasdfasdfasdfasdfasdfasdfasdf"

    });

Generated my own token based on some kind folks here: Login prompt appearing randomly · Issue #300 · Esri/resource-proxy · GitHub

View solution in original post

5 Replies
RobertScheitlin__GISP
MVP Emeritus

Khanh,

   Can we see where you define the esriConfig.defaults.io.proxyUrl portion in your code?

0 Kudos
KhanhPham1
New Contributor II

Of course...viewer.js

Capture.PNG

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Khanh,

   You are not manually appending the proxy.ashx to any of your url strings in your code are you?

Some advice, I never use localhost. I always use my machine name (i.e. gislap183). There is probably no reason to use "alwaysUseProxy" as true. You only want to proxy urls that require proxy'ing.

0 Kudos
KhanhPham1
New Contributor II

Robert,

No, I'm not manually appending anything.  When I turn off "alwaysUseProxy", I get the login form even though I have "urlUtils.addProxyRule." I'll change localhost to machine name and see if that helps.

Thanks for your input.

0 Kudos
KhanhPham1
New Contributor II

For others that might have the same problem.  I solved it but not sure if it's best practice.

esriConfig.defaults.io.proxyUrl //removed

esriConfig.defaults.io.alwaysUseProxy = false;

urlUtils.addProxyRule({

        proxyUrl: "https://xxxx/proxy/proxy.ashx",

        urlPrefix: "https://xxx/arcgis/rest/services/xxxx/xxxx/MapServer",

        accessToken: "1xxxxxxxxxxxxxxasdfasdfasdfasdfasdfasdfasdfasdf"

    });

Generated my own token based on some kind folks here: Login prompt appearing randomly · Issue #300 · Esri/resource-proxy · GitHub