Esri/esri-leaflet-vector

Add support for a proxy

pdiddyb opened this issue · 3 comments

Describe the problem

I do not see a parameter to add a proxy to proxy when adding a L.esri.Vector.vectorTileLayer. I can add the proxy to the portalUrl, but after the initial calls it will start making requests for tiles to the server address from the service.

Describe the proposed solution

If we had a proxy parameter then we would be set that.
Currently I am trying this by prepending the proxy to the portalUrl:

      var l1 = L.esri.Vector.vectorTileLayer(itemID, {
        portalUrl: proxyUrl + '?' + portalURL,
      });

If we had a proxy parameter then it would look like this:

      var l1 = L.esri.Vector.vectorTileLayer(itemID, {
        portalUrl: portalURL,
        proxy: proxyUrl,
      });

Alternatives considered

No response

Additional Information

No response

@pdiddyb thank you for the report. Could you please update the request with a replication case?

@gavinr-maps We went ahead and added a proxy property. I made PR 193

@pdiddyb I would recommend using the style option io transform the style after it retrieved from teh portal:

      var l1 = L.esri.Vector.vectorTileLayer(itemID, {
        portalUrl: proxyUrl + '?' + portalURL,
        style: (portalStyle) => {
          // modify URLs in the portal style to point to your proxy.
          return portalStyle
        }
      });

Testing and implementation of a proxy parameter opens up quite a bit of maintenance surface area. Additionally documenting exactly what and which proxy to use and what the proxy supports will be difficult and add additional surface area and support to the API.