Select to view content in your preferred language

What's the proper configuration for proxy.config and config.json for a self-hosted Web AppBuilder for ArcGIS Web Application?

29126
20
Jump to solution
02-04-2015 03:10 PM
AlexMahrou
Deactivated User

I can't find a solid document on this, and Esri support was just trying to fill in the gaps....

I have an application that I configured through our web appbuilder for arcgis on our organization site. I have since downloaded the code and pasted the requisite json from the web app into the config.json on my web server at https://mywebserver/webapp

my proxy is located here: https://mywebserver/DotNet/proxy.ashx

I have registered the application and have a clientid, and secret on agol.

clientid: clientid123

appsecret: appsecret123

I can successfully browse to the application at https://mywebserver/webapp without the proxy and get prompted to enter my agol creds and it works. I just would like to remove the agol popup and enforce my own iis security. To do this I need a proper configuration in my proxy and in my json.config. Can someone use the variables that I quoted above and tell me what my <ProxyConfig> tags in my proxy.config file, and what my "httpProxy" section should look like in my config.json?

I think that's all I need. 😉

20 Replies
MatthewCarey
Regular Contributor

Alex, thanks so much for writing this up so simply. I tried to use your process with my own web mapping application.

Unfortunately I'm still having the AGOL pop-up appear and ask for my credentials (there's a small generic message box, then when I click OK it takes me to a sign-in pop up page that's customized based on my AGOL organization) and I can't figure out why.

The application resides on my server which is only viewable inside my organization, and the AGOL web map it references is shared with the Organization.

I'm wondering if this is relevant - In the browser (Chrome) console, I see:

Any ideas how I might troubleshoot this? The proxy log seems to indicate that it's having success but nonetheless something is obviously mis-configured somewhere...

Thanks!

BillSpiking__GISP
Frequent Contributor

Hi Matthew,

I'm getting the same results with the AGOL pop-up.  Did you find away of getting this resolved?

Thank you,

Bill

0 Kudos
MatthewCarey
Regular Contributor

Hi Bill,

No, I'm afraid I didn't receive any responses so I've been dormant on this issue for a couple of weeks.

I thought I might have unique issues and everyone else is all set.

Are you seeing the same error messages by any chance?

I figure I'll try and reach out to Esri directly next, and will let you know if we figure it out.

Cheers,

Matt

0 Kudos
BillSpiking__GISP
Frequent Contributor

Yep, I'm seeing the same thing.  I'll submit a help ticket as well and let you know what I find out.

0 Kudos
MatthewCarey
Regular Contributor

It turns out that when I swapped out my hosted feature layer for a map service from my organization's ArcGIS Server that's only viewable internally in my AGOL webmap and saved it, it worked with no sign-in required!

So I didn't solve this precise issue but I think the workaround will work for me.

Hope this might help....

MelanieHammond1
Deactivated User

I'm having the same issues and can't get it to work no matter what I try with the proxy and config. Did you hear anything from Esri?

0 Kudos
MelanieHammond1
Deactivated User

I submitted a ticket to Esri and was told that basically a map on AGOL must be shared publically to prevent the AGOL sign in from popping up. Sure hope they are planning on allowing a map from Server soon or else the whole WAB becomes fairly useless to us. I'll update if I hear something different.

0 Kudos
C_EHoward
Frequent Contributor

That is what i was told too but it seems if the proxy is configured right you have a web map and web app 'not shared' and still have it appear. After talking to the SDK people for a while yesterday, they concluded I could not use the proxy with a webapp builder app from AGOL. Yet as we see there are help pages for AGOL WAB that say use of a proxy is possible. After trial and error by myself, here is what I think works. I say 'think' because I have so many test maps and apps it is hard to keep them all straight!

My steps are as follows- using a web map that is not shared and a  web app that is not shared (created with WAB on AGOL)

1. after cresting the web app, I downloaded that code and saved it to my web server to host the app there. The app now has a URL from my server nistead of having to use the AGOL URL.

2. Create an AGOL content item using the URL from my hosted app. created as a web mapping app, with app type = browser. I then registered it to get the appID

3. I added the appID to the config.json from the downloaded app. I had to change the text encoding to make it look nicer in notepad++

4. I added the proxy code at the end of the web app. I dont enough about javascript to know where you can/cannot add the code, but I do know you have to be mindful of the , and } and ] that each of the code elements use. So my copied code here will show how I added it after the last item in the original config.json

,"httpProxy": {

  "useProxy": true,

  "url": "", *** i did not need to add anything here although i have tried the proxy URL (below) as well as                     http://www.arcgis.com/sharing/rest, simply because that was an example i was given by support at                     some point

  "alwaysUseProxy": false,

  "rules": [{

  "urlPrefix": "http://www.arcgis.com",

  "proxyUrl": "http://mysite.com/dotnet/proxy.ashx"

  }]

  }}}}}}

I then go to my custom URL and am able to see the map, no log in required! I should mention that this is with map services that are secure, yet have the credentials saved. If I use the regular REST endpoint for my services, I still get a log in screen. So I would recommend saving credentials w/secure services (as an AGOL item) as not sharing the web map still requires credentials for map content and does not seem to be handled by the proxy (unless you put in the reference to your services in your proxy.config)

Anyway, I hope this helps someone else. After being told by support that this is, and then is not possible, I wound up figuring it out on my own. I really wish there was consistency in what support analysts told us. To do my job,  I need to know how to use all products to produce a end result-- a web app that uses services, Server, MXDs, AGOL content, etc-- I need someone who can tell me how it work it all together. (OK rant over.... )

EmmanuelRosetti
Deactivated User

Hi,

I also have a problem with the proxy and WAB. Here is my situation : I develop a widget that needs to access data from a mapservice hosted on my ArcGIS Server. I can't let this ressource unsecured so I have ArcGIS Users and Roles for that AGS and some of the roles have access to the service.

My application built with WAB needs to access those data without asking the user for credentials.

So I use the proxy to pass my parameters username and password in the proxy.config file but everytime I try to access (through the wab or directly in the browser) one of the services I registered through the proxy, I receive the ArcGIS Login Rest endpoint.

Isn't the proxy DotNet made by ESRI on github supposed to get the token by itself and proxy my request to the service and return the REST result?

Thanks for your help.

0 Kudos
RebeccaStrauch__GISP
MVP Emeritus

Emmanuel, you may want to read thru Internal ONLY Web Map Sharing Issues for more related info on the proxy with WAB and local services.

0 Kudos