Thursday, October 18, 2018

Arcgis Web Application Builder Proxy

I started on this path months ago, possibly a year ago. I needed to setup a proxy to allow access to a web maps/web map application. For months, I read every blog and every forum posting. I watched YouTube videos. But I will have to admit, the little bits and pieces were always vague and never 100% the answer for me. I think because the process of configuring json is just complicated. It is too bad arcgis makes it so complicated. If it was a just click and add setup, people would not have so many issues doing this.
I spent weeks configuring and re-configuring. Nothing worked. I thought it simply wasn't possible. I READ every instruction.
It dawned on me that I should create a vanilla Web Mapping application with nothing access. Just a map that does not access any private data only private because it is protected on arcgis. I got it working so that gave me hope. It also taught me that I had to setup the proxy url with the least amount of specific url data and put matchAll="true". This means if I am trying to access "https://YOURSITE.maps.arcgis.com/rest/content/blahblahblah", then I just want to put the beginning portion (https://YOURSITE.maps.arcgis.com/) of it and if a url 'contains' it, use the proxy to authenticate.
And another thing for services like Feature Services or Layers, I could use the ClientId/Secret to get tokens but for portal items like maps, I had to use the username/password. I found a very important tidbit. The user name is Case Sensitive, the acutal login into the arcgis web page IS NOT. I have been using lower case to log into the website and I did not realize it has Uppercase values. I confirmed this by logging the website and looking up my account information!
Make sure you watch your https or http, that also causes issues.
I should note, I registered the Web Mapping Application. I know you probably did all this already, but I have to mention it. That is where you get your clientId and clientSecret
Here are some vague instuctions: https://developers.arcgis.com/web-appbuilder/guide/getstarted.htm
Next, I downloaded the entire Web Mapping application, they are quite large and I wish I did not have to do this, and then uploaded it to my server.
Finally, I followed these instructions over and over and over and kept not getting past the login. I did what the instructions said - insert the httpProxy tag near the bottom of the config file.
(I noticed in the Developer tools that it was never hitting the Proxy for any of the calls which made me think I was missing something). If it is hitting the proxy, you will see in the tools something like this for every secure service, if not, you are missing the httpProxy rule on that particular call: