Private Tile Servers and Mapbox layers - how to send credentials - Python


We have recently locked down our private osm tile server and now cant see it in dash. We are getting a CORS error followed by Uncaught (in promise) Error: Mapbox error. Turning CORS on locally we loose the CORS error and keep the mapbox error.

We have diagnosed what is happening : the request to url doesn’t include credentials (i.e. the session cookie) and gets redirected to the login endpoint which doesn’t have CORS. We want to modify the request parameters for the calls to the tile-server, setting withCredentials: true so we dont get the redirect but it doesnt seem from the docs that anything like this is possible.


Are private tile servers accessible with mapbox layers? docs only make reference to open servers
If so how can we send the credentials with the URL?
If not do you have any suggestions as to how to remedy this?

Update - we have found that this is possible in mapbox via options.transformRequest

so another question is can anyone direct us to the entry point of dash into the mapbox.options?
Seems to be here at 8cebd31e18bf319a0a6856d031fb63e73dbf4eed · plotly/ · GitHub line 402 def _prop_descriptions(self): which calls the various option functions. So I suppose we need to add transformRequest to that by writing a transform request function (disclaimer I’m a data scientist not software dev haha)

@chriddyp can you confirm any of this? Additionally would these be a wanted PR?



Hi, I’m having the same issue with the same two errors (CORS & Uncaught in promise).
Based on your experience, do you have any suggestions on how to resolve? I’m working with plotly python.

I made a recent post on my issue but approaching it with a more general question.

Many thanks,