WAB Dev Edition proxy.js and WMS service with AddData Widget

549
1
11-04-2021 09:44 AM
EMiller_2
New Contributor III

I have a Web Appbuilder Developer Edition application running on my company’s server. We are running a reverse proxy and a strict content security policy but I do not think that is the problem. 

The problem I am currently having is with adding a WMS service in the browser using the AddData Widget manual add url pane. I am using the example url provided in the widget, which is https://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r.cgi?service=WMS&request=GetCapabilities. It is allowed through the content security policy.

The WAB application seems to require that the proxy.js be used to allow this url (which is an XML GetCapabilities file). I am able to do this successfully in my development environment, and the WMS map service comes into the map fine. However this is not working on the deployment company server.

For example purposes, the application itself is at this url: https://mycompanyserver_url/myapp

I have a rule set up in the config.json file which contains the above mesonet url and also points to the location of the proxy.js file, like this:

"httpProxy": {
    "useProxy": true,
    "alwaysUseProxy": false,
    "url": "",
    "rules": [{
		"urlPrefix": "https://mesonet.agron.iastate.edu/",
		"proxyUrl": "https://mycompanyserver_url/myapp/proxy.js"
		}]
  },

When I try to add the WMS url in the AddData tool, the application goes to

proxy?https://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r.cgi?service=WMS&request=GetCapabilities 

as expected, but it doesn’t find the XML because the proxy isn’t passing anything through.

Instead, it simply finds the proxy.js file. In other words, if I go here in a browser tab:

https://mycompanyserver_url/myapp/proxy.js?

I simply hit the proxy.js file itself.

Can someone help me understand why proxy.js is not operating as a proxy and passing the url on to the application? Proxy.js is part of the application, which is allowed through the reverse proxy so I cannot understand why it is not functioning. It functions in my development setup.

 

 

 

 

0 Kudos
1 Reply
KenBuja
MVP Esteemed Contributor

I have the proxy information set up this way on a custom WAB site we host

  "httpProxy": {
    "useProxy": true,
    "alwaysUseProxy": false,
    "url": "https://ourserver/proxy.ashx",
    "rules": []
  },