Could someone point in the right direction as to why the proxy duplicate the url:
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>
Solved! Go to Solution.
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
Khanh,
Can we see where you define the esriConfig.defaults.io.proxyUrl portion in your code?
Of course...viewer.js
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.
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.
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