0

I m triying to add a secured feature service to CMV using a proxy page.

My viewer.js file is the following:

esriConfig.defaults.io.proxyUrl = 'myProxyURL';
esriConfig.defaults.io.alwaysUseProxy = false;

operationalLayers: [
{
            type: 'feature',
            url: 'myURL',
            title: i18n.feature1,
            options: {
                id: 'feature_layer_1',
                opacity: 1.0,
                visible: true,
                outFields: ['*'],
                mode: 0
            }
},

And my proxy.config file:

<?xml version="1.0" encoding="utf-8" ?>
<ProxyConfig allowedReferers="*"
         logFile="proxy_log.log"
         mustMatch="false">
    <serverUrls>
        <serverUrl
            url="myURL"
            username="myusername"
            password="mypassword"
            rateLimit="120"
            rateLimitPeriod="60"
            matchAll="true"/>
    </serverUrls>
</ProxyConfig>

But when the CMV is starting, it prompts me to put username and password... What am I doing wrong?

2 Answers 2

0

I think you need to set alwaysUseProxy to true (so it uses your proxy for every request) or include something like this in your viewer.js (you'll also need to require the urlUtils module) so the API knows which services to use the proxy for:

        esriConfig.defaults.io.proxyUrl = 'relativePathToYourProxy/proxy.ashx';
        var serversToProxy = [ 'services.arcgisonline.com', 'acme.com', 'server.arcgisonline.com' ];

        array.forEach( serversToProxy, function( server) {

            urlUtils.addProxyRule( {
                urlPrefix: server,
                proxyUrl: 'relativePathToYourProxy/proxy.ashx'
            } );

         }, this );
-1

If you use Arcgis Server 10.3 can see: Support for ArcGIS Server 10.3 #177 https://github.com/Esri/resource-proxy/issues/177

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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