Public facing app that uses a proxy?

4260
9
Jump to solution
06-16-2016 11:13 AM
RyanKelso
Occasional Contributor III

Do any of you have a public / external facing app that is using the proxy?  If so, in general terms, how did you configure it for this?  For example, I have an app deployed on IIS that I access internally using http://gisserver/webapp and it uses the proxy at http://gisserver/DotNet/proxy.ashx.  But I'm trying to make it available at something like http://www.webapp.mydomain.com and I'm having some trouble with including the proxy in the mix.

I got some help from Esri that I am working on, but I was hoping to get any advice from somebody with practical experience with this.

Tags (2)
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Ryan,

  The use of the proxy is controlled by the allowed referrers list in the proxy.config. You can use my site to monitor traffic as an example

http: //gis.calhouncounty.org/ParcelViewer3.1.1/

View solution in original post

9 Replies
RobertScheitlin__GISP
MVP Emeritus

Ryan,

  Almost all my widget live preview sites use a proxy and definitely my main county site does. You need to use your external URL s in when setting up your app in WAB and when adding the serverUrls to your proxy.config. When adding the proxy url to your apps main config.json you need to use the external url to your proxy as well.

RyanKelso
Occasional Contributor III

Ok, thanks.  I guess I was under the impression that the proxy would not be exposed externally.  While trying to understand this, I was looking to find an example in somebody else's app where I could monitor the network activity and see a request made thru a proxy, and was not able to find an example of this.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Ryan,

  The use of the proxy is controlled by the allowed referrers list in the proxy.config. You can use my site to monitor traffic as an example

http: //gis.calhouncounty.org/ParcelViewer3.1.1/

RyanKelso
Occasional Contributor III

Thanks, Robert.  Your site pretty much demonstrated exactly what I was wanting to see.  I also forgot about (and didn't fully understand) the allowed referrers list, so thanks for mentioning that too.

0 Kudos
TroyDawson
New Contributor II

Greetings Robert,

what does your proxy.config file look like? Can you provide a sample? I'm having difficulties accessing/viewing my web app on the external site...all I see is the loading screen and then a frowning face. 

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Troy,

  Here is the main lines:

<serverUrl url="https://www.arcgis.com" matchAll="true"/>
<serverUrl url="http://calhoun.maps.arcgis.com/sharing/rest" matchAll="true" username="username" password="password" />

0 Kudos
TroyDawson
New Contributor II

Am I missing something...please advise..Here is what my proxy.config file look like:

<?xml version="1.0" encoding="utf-8" ?>
<ProxyConfig allowedReferers="*"
mustMatch="true">
<serverUrls>
<serverUrl url="https://InternalServer/arcgis"
matchAll="true"/>

<serverUrl url="https://InternalServer/arcgis"
username="****"
password="****"
matchAll="true"/>

<serverUrl url="https://Externalserver/portal"
username="****"
password="****"
matchAll="true"/>

also here is what my config.json file for the web app looks like (after deploying to IIS):

Snippet

{"theme":{"name":"FoldableTheme","styles":["default","black","blue","cyan","green",
"purple","red","yellow"],"version":"1.4"},"portalUrl":"https://InternalServer/portal",
"appId":"xmbXBa0pB97rMQMM","authorizedCrossOriginDomains":[],"title":"test_5","subtitle":
"with Web AppBuilder for ArcGIS","logo":"images/app-logo.png","geometryService":
"https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer","links":[],
"widgetOnScreen":{"widgets":[{"uri":"themes/FoldableTheme/widgets/HeaderController/Widget",
"position":{"left":0,"top":0,"right":0,"height":40,"relativeTo":"browser"},"version":"1.4","id":
"themes_FoldableTheme_widgets_HeaderController_Widget_1","name":"HeaderController","label":
"Header Controller"},{"uri":"widgets/Scalebar/Widget","position":{"left":25,"bottom":25,
"relativeTo":"map"},"version":"1.4","id":"widgets_Scalebar_Widget_2","name":"Scalebar",
"label":"Scalebar"},{"uri":"widgets/Search/Widget","position":{"left":55,"top":5,"relativeTo":"map"},
"version":"1.4","id":"widgets_Search_Widget_3","name":"Search","label":"Quick Ownername Search",
"config":"configs/Search/config_Quick Ownername Search.json"},{"uri":"widgets/Coordinate/Widget",
"position":{"left":200,"bottom":20,"relativeTo":"map"},"version":"1.4",
"id":"widgets_Coordinate_Widget_4","name":"Coordinate","label":"Coordinate"},
{"position":{"left":55,"top":45,"relativeTo":"map"},"placeholderIndex":1,"id":"_5","name":"Query",
"label":"Application Seach","version":"1.4","uri":"widgets/Query/Widget","config":
"configs/Query/config_Application Seach.json"},{"position":{"left":105,"top":45,"relativeTo":"map"},
"placeholderIndex":1,"id":"_6","name":"Query","label":"Parcel Search","version":"1.4","icon":
"configs\\Query\\icon_Parcel Search.jpeg","uri":"widgets/Query/Widget","config":
"configs/Query/config_Parcel Search.json"},{"position":{"left":155,"top":45,"relativeTo":"map"},
"placeholderIndex":1,"id":"_7"},{"position":{"left":205,"top":45,"relativeTo":"map"},
"placeholderIndex":2,"id":"_8"},{"position":{"left":255,"top":45,"relativeTo":"map"},
"placeholderIndex":3,"id":"_9"},{"uri":"widgets/OverviewMap/Widget","position":{"bottom":0,
"right":0,"zIndex":1,"relativeTo":"map"},"version":"1.4","id":"widgets_OverviewMap_Widget_10",
"name":"OverviewMap","label":"Overview Map"},{"uri":"widgets/HomeButton/Widget","position":
{"left":7,"top":75,"relativeTo":"map"},"version":"1.4","id":"widgets_HomeButton_Widget_11","name":
"HomeButton","label":"Home Button"},{"uri":"widgets/MyLocation/Widget","position":
{"left":7,"top":110,"relativeTo":"map"},"version":"1.4","id":"widgets_MyLocation_Widget_12","name":
"MyLocation","label":"My Location"},{"uri":"widgets/AttributeTable/Widget","position":{"relativeTo":
"browser"},"version":"1.4","id":"widgets_AttributeTable_Widget_13","name":"AttributeTable","label":
"Attribute Table"},{"uri":"widgets/Splash/Widget","visible":false,"position":{"relativeTo":"browser"},
"version":"1.4","id":"widgets_Splash_Widget_14","name":"Splash","label":"Splash"},
{"uri":"widgets/ZoomSlider/Widget","position":{"top":5,"left":7,"relativeTo":"map"},
"version":"1.4","id":"widgets_ZoomSlider_Widget_15","name":"ZoomSlider","label":"Zoom Slider"}],
"panel":{"uri":"jimu/OnScreenWidgetPanel","position":{"relativeTo":"map"}}},"map":
{"3D":false,"2D":true,"position":{"left":0,"top":40,"right":0,"bottom":0},"itemId":
"77cd07c973344571bfd1f2636f318088","mapOptions":{},"id":"map","portalUrl":
"https://InternalServer/portal"},"widgetPool":{"panel":{"uri":"themes/FoldableTheme/panels/
FoldablePanel/Panel","position":{"top":5,"right":5,"bottom":5,"zIndex":5,"relativeTo":"map"}},
"widgets":[{"uri":"widgets/Legend/Widget","version":"1.4","id":"widgets_Legend_Widget_16","name":
"Legend","label":"Legend","index":0},{"uri":"widgets/LayerList/Widget","version":"1.4","id":
"widgets_LayerList_Widget_17","name":"LayerList","label":"Layer List","index":1}]},"loadingPage"
:{"backgroundColor":"#508dca","backgroundImage":{"visible":false},"loadingGif":{"visible":true,
"uri":"configs/loading/images/predefined_loading_1.gif","width":58,"height":29}},"wabVersion":"1.4",
"isTemplateApp":false,"isWebTier":false,"httpProxy":{"useProxy":true,"alwaysUseProxy":false,"url":"",
"rules":["urlPrefix": "https://Externalserver/arcgis/rest/services/MAPS/Application_2017_test/
MapServer","https://Externalserver/arcgis/rest/services/MAPS/tortola_parcels/MapServer",
"https://Externalserver/arcgis/rest/services/MAPS/Tortola_Image_W_Lables_Planning_Authority_Final
/MapServer","proxyUrl": "https://Externalserver/DotNet/proxy.ashx"]}}

when I attempt to open this web app on the internet, I get "Unexpected token : in JSON at position 4249"
please advise..

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Troy,

   There is a couple of things I can tell you. In your proxy.config you have

<?xml version="1.0" encoding="utf-8" ?>
<ProxyConfig allowedReferers="*"
mustMatch="true">
<serverUrls>
<serverUrl url="https://InternalServer/arcgis"
matchAll="true"/>

<serverUrl url="https://InternalServer/arcgis"
username="****"
password="****"
matchAll="true"/>

<serverUrl url="https://Externalserver/portal"
username="****"
password="****"
matchAll="true"/>

All the urls should be to your external ArcGIS server address and you only need to list the external server address once not once for each map service.

i.e. <serverUrl url="http://gis.calhouncounty.org" matchAll="true"/> You use the lowest level of the url as possible and the matchAll handles the rest for you.

In your config.json proxy rules the same holds true you only need https://Externalserver/arcgis/rest/services. Your web map should be using your external urls as well.

TroyDawson
New Contributor II

Greetings Robert,

Must have overlooked this reply. Thanks for taking the time out to review and respond to my post. I will make the changes and give it a try. 

Thanks in advance

0 Kudos