I have been using the proxy setup described by Robert Scheitlin here:
Internal ONLY Web Map Sharing Issues
to get around AGOL logins for an internal-only, locally-hosted WAB Dev app that calls an AGOL Web Map. I used username and password authentication. The referenced Web Map is shared with my organization, and is not publicly available.
When I updated the app to WAB Dev 2.4, the proxy setup no longer works, and all I get is a blank (white) browser screen.
App config.json:
"httpProxy":{
"useProxy":true,
"alwaysUseProxy":false,
"url":"/DotNet/proxy.ashx",
"rules":[{
"urlPrefix": "http://myorg.maps.arcgis.com/",
"proxyUrl": "/DotNet/proxy.ashx"
}]
},
proxy.config:
<?xml version="1.0" encoding="utf-8" ?>
<ProxyConfig allowedReferers="*"
mustMatch="true">
<serverUrls>
<serverUrl url="http://myorg.maps.arcgis.com"
username="username"
password="password"
matchAll="true"/>
<serverUrl url="http://services.arcgisonline.com"
matchAll="true"/>
<serverUrl url="http://myinternalserver"
matchAll="true"/>
</serverUrls>
</ProxyConfig>
<!-- See https://github.com/Esri/resource-proxy for more information -->
Does anyone know how I can get the proxy working again? The proxy is still working for my WD 2.3 apps on the same server. I'm running ArcGIS Server 10.5.
Solved! Go to Solution.
Jeff,
Mixing http and https is not a good thing to do (but I see you mentioned you already tried setting all urls to https). You should change your urls to https again and leave it that way. Your url to your proxy server is the internal machine name gissvr you should use the external machine name. Have you tested your proxy using http://gissvr/DotNet/proxy.ashx?ping
I also notice in your config.json file you have the proxy rule urlPrefix set to https://www.tog.maps.arcgis.com (it should not have "www").
Does you app function properly if you set the useProxy to false (meaning you have to login, but you do not get the error)?
Hi Robert,
Thanks for replying. I did set the urls all back to https, and I fixed the url that had the www in it (the agol one). I still am getting the error.
I set useproxy to false, and it works, I get the login box.
When I ping the page I get { "Proxy Version": "1.1.1-beta", "Configuration File": "OK", "Log File": "Not Exist/Readable"}
We have an internal server (gissvr is the alias) that I host our internal apps on, and an external server (www.gilbertmapping.com<http://www.gilbertmapping.com>) that has a web adaptor that is connected to gissvr. I put the proxy on both machines, as I’m not sure which one it uses. I changed the url in the config.json to use the external server, so I would assume that it is now using the proxy.config on the external server.
I had also tested hosting the app on the external server, and using the proxy on the external server. That way the internal server wasn’t even a part of it all. I still get the same error though.
Thanks,
Jeff
Jeff,
If everything is on the external server now can you provide the url so I can test?
Hi Robert,
The url is below:
http://www.gilbertmapping.com/wab/DevAgreements/index.html
Thanks,
Jeff
Jeff,
In the SelectionManager.js You seem to have made some chenages and introduced a major syntax error:
define([
'dojo/_base/declare',
'dojo/_base/Deferred',
'dojo/_base/lang',
'dojo/_base/array',
'dojo/topic',
'esri/layers/FeatureLayer',
'esri/layers/GraphicsLayer',
'esri/geometry/geometryEngine',
'esri/graphic',
'esri/Color',
'esri/symbols/SimpleMarkerSymbol',
'esri/symbols/Sinew SimpleLineSymbol(lineSolidStyle, Color.fromArray([0, 255, 255]), 2);
line 13 and following is the issue above:
define([
'dojo/_base/declare',
'dojo/_base/Deferred',
'dojo/_base/lang',
'dojo/_base/array',
'dojo/topic',
'esri/layers/FeatureLayer',
'esri/layers/GraphicsLayer',
'esri/geometry/geometryEngine',
'esri/graphic',
'esri/Color',
'esri/symbols/SimpleMarkerSymbol',
'esri/symbols/SimpleLineSymbol',
'esri/symbols/SimpleFillSymbol'
],
function(declare, Deferred, lang, array, topic, FeatureLayer, GraphicsLayer, geometryEngine,
Graphic, Color, SimpleMarkerSymbol, SimpleLineSymbol, SimpleFillSymbol) {
var instance = null;
var clazz = declare(null, {
constructor: function(){
if(window.isBuilder){
topic.subscribe("app/mapLoaded", lang.hitch(this, this._onMapLoaded));
topic.subscribe("app/mapChanged", lang.hitch(this, this._onMapChanged));
}else{
topic.subscribe("mapLoaded", lang.hitch(this, this._onMapLoaded));
topic.subscribe("mapChanged", lang.hitch(this, this._onMapChanged));
}
},
/**
* The display layers(GraphicsLayer) for layer in mapService. The display layer is used for show highlight.
* For feature layer in map, we don't need display layer because the feature layer will show the highlight.
* @type {Object}
*/
_displayLayers: {},
setSelectionSymbol: function(layer){
var type = layer.geometryType;
var markerCircleStyle = SimpleMarkerSymbol.STYLE_CIRCLE;
var pointSymbol = new SimpleMarkerSymbol(markerCircleStyle, 16, null, Color.fromArray([0, 255, 255]));
var lineSolidStyle = SimpleLineSymbol.STYLE_SOLID;
var lineSymbol = new SimpleLineSymbol(lineSolidStyle, Color.fromArray([0, 255, 255]), 2);
var fillSolidStyle = SimpleFillSymbol.STYLE_SOLID;
var fillSymbol = new SimpleFillSymbol(fillSolidStyle, lineSymbol, Color.fromArray([0, 255, 255, 0.3]));
if (type === 'esriGeometryPoint') {
layer.setSelectionSymbol(pointSymbol);
} else if (type === 'esriGeometryPolyline') {
layer.setSelectionSymbol(lineSymbol);
} else if (type === 'esriGeometryPolygon') {
layer.setSelectionSymbol(fillSymbol);
}
},
You should probably just restore the SelectionManager.js from the stemApp.
That’s odd. I didn’t edit that file, I had to search for it even, I never knew it was there (unless I made a change to a widget that updated that file somehow, but I thought widgets were self contained). Anyway, I copied over the original SelectionManager.js file from the stemapp of the wab install folder. Now the internal one does not get the error (the proxy doesn’t work either, I get a login box, I made sure I set useProxy back to true after testing yesterday). However, the external one still gets the same error. I replaced the file in both deployments.
Jeff,
Syntax errors are killing you right now. Here is your next issue in the apps config.json:
"httpProxy": {
"useProxy": true,
"alwaysUseProxy": false,
"url": "https://www.gilbertmapping.com/DotNet/proxy.ashx",
"rules": [
{
"urlPrefix:":"https://tog.maps.arcgis.com",
"proxyUrl":"/DotNet/proxy.ashx"
}
]
}
Line 7 you have "urlPrefix:":"https://tog.maps.arcgis.com", and it should be:
"httpProxy": {
"useProxy": true,
"alwaysUseProxy": false,
"url": "https://www.gilbertmapping.com/DotNet/proxy.ashx",
"rules": [
{
"urlPrefix":"https://tog.maps.arcgis.com",
"proxyUrl":"/DotNet/proxy.ashx"
}
]
}
Hi Robert,
Good catch. I always miss these things, that’s a big part of what makes js difficult for me. David had also mentioned that I could have missed something like that. I’m surprised tech support didn’t see that.
I still get the same results though…
Jeff,
I don't get the white screen, frowny face error anymore. I just get the login dialog now. When I look at the network traffic I see that the request to your portal through your proxy has an error of "Invalid Token". This means that your provided credentials in the proxy.config are not correct.
Hi Robert,
I did try the external one on a different machine, and I got the same as you did. I will check my credentials. Should I be using the client ID or the username for the service?
Also, how did you discover the SelectionManager.js had bad syntax? I never saw that come up in anything I ran (fiddler, f12 dev tools). That kind of stuff worries me, that a simple change could possibly break the whole thing.