GeoNode/geonode-mapstore-client

Adopt the new download_urls array property

Closed this issue · 4 comments

Since GeoNode/geonode#11421 the resource API endpoints return a new array property for the download URL:

 "download_urls": [
   {
      "URL": .... , 
      "ajax_safe": true|false, 
      "default":true|false
   },
]

It's array in view of supporting multiple download URLs. At the moment only one value is returned, with the default property set to true.

The relevant addition is the ajax_safe property. This value tells the client if the download URL can be called with AJAX or if an href should be used instead. This information is important for specific downloads that do not use the GeoNode backend but use instead external URLs that might not support CORS.

@giohappy sorry for commenting on this older issue here. I have some trouble to get the point here.

This information is important for specific downloads that do not use the GeoNode backend but use instead external URLs that might not support CORS.

How does the GeoNode backend finds out, if a URL is "ajax_safe" and what does it set in particular?

In any case: For an external endpoint which do not allow CORS, couldn't the client just use a proxy or are there any other concern I do not see ATM?

@ridoo at the moment it uses a simple heuristic:

  • datasets: if they're not provided by a custom Link they're considered AJAX safe, since they're served by GeoNode's Geoserver WPS service (see here)
  • documents: if they're local document (not served from an external URL) they're considered AJAX safe (see here)

this logic is reflected inside the output generated by the serializer.

A custom download handler for datasets can override the DatasetDownloadHandler.is_ajax_safe() method to implement a different logic.

Notice that this applies only to downloads. For the preview of datasets and documents things are very different.

Thanks for your feedback and the pointers!

So the intention seems to be avoid using a proxy for download links linking to (maybe) CORS disabled backends, as you do not want big datasets to be looped through the GeoNode backend.

Yes @ridoo