mapbox / mapbox.js

Mapbox JavaScript API, a Leaflet Plugin
mapbox.com/mapbox.js/
Other
1.92k stars 386 forks source link

Don't force HTTPS on style URL's #1304

Closed whyvez closed 4 years ago

whyvez commented 4 years ago

If HTTP_URL is set and FORCE_HTTPS is false all requests use HTTP with the exception of the first style fetch request.

The root cause is in the style function in the format_url module forces HTTPS regardless of the config.

https://github.com/mapbox/mapbox.js/blob/a606ef3d082a55a48983a2197822b5446babed09/src/format_url.js#L52-L60

The request module is already equipped with making decisions on the protocol based on the config and other variables, why not defer that decision to the request module?

I propose we remove the explicit replace in line https://github.com/mapbox/mapbox.js/blob/publisher-production/src/format_url.js#L57