10-03-2017 08:50 PM - edited 10-03-2017 08:55 PM
Our client has a portal and they are using a third party wms service. The service is displaying fine in leaflet.
However, when consuming the service in portal, it displays the message "Not available Please refresh your browser and try again".
I also check the url requests and they do return images.
I also play aroudn the wms configuration (display mode) in the portal to see whether it helps but no luck so far.
Appreciate all ideas and suggestions to resolve this problem.
10-04-2017 05:13 AM
The "Not Available" image is returned by the WMS service. Can you double check the WMS URL that you can see in the developer console - copy and paste it to new browser tab? Is the BBOX correct, x/y axes order?
10-04-2017 02:39 PM
The url wms is http and it has structure as follows.
From my testing, I have no issue adding the service into the portal data sources. I also monitor the request get image urls, generated by portal, I paste them to a new browser tab, they all return images; however, according to the source, the "Not avaiable" displaying in Portal Map indicate that something incorrect in the URL either api_key or map service name are incorrect which confuses me.
I wonder Portal could do something to trigger the "Not avaiable" image
10-05-2017 12:03 AM - edited 10-05-2017 12:43 AM
I found the source of the problem but it opens other questions...
This behavior is caused because of different request header used by Portal and by web browser:
When I replay the request sent by Portal in Fiddler, it displays the "Not Available" image. But if I remove the Referer request header, normal image will display. For me it looks like some kind of limitation on the WMS service. I am not sure whether this can be somehow altered from the Portal side
I will investigate further...
10-05-2017 12:26 AM
After thinking about this for a while I came to a conclusion that this is by design:
Portal sends URLs to the services which can be comparable as having links on your webpage and user clicks them. Because of that, the web browser adds HTTP Referer to the request and this will ultimately fail on your WMS service provider as it for some reason does not like requests having this header. I quite don't understand why they would not like to process this requests as it's mainly used for statistical purposes...
The way to work around this problem is to customize the global browser setting to disable this
Disabling the HTTP Referer should not have any side effects except having unrelated ads displayed on web pages
10-13-2017 01:30 AM
Requiring a properly set Referrer header looks like some kind of authorization mechanism employed by the WMS. Why it doesn't throw up when the header is missing undermines this theory, though.
Either way, hiding the Referrer header looks like an ugly hack (and not cross-browser to that). I'm wondering on the exact way you constructed your test harness utilizing Leaflet, because Consumer Portal uses it as well and it uses standard browser capabilities to display images which result in the header being added. The only time we saw the Referrer header being skipped is when you run your image loading site (Leaflet based, or Geospatial Portal) from the local file system or from inside a sourceless IFrame. This still doesn't look like a production-worthy workaround.
Apart from all that, this looks like a try in abusing the WMS which uses an API key. Is it your API key? Can you ask the WMS owners to reconfigure it?