Skip to content

Support setting custom HTTP headers before Map initialization #1062

@Taharu

Description

@Taharu

We can set custom HTTP headers via setCustomHeaders(...), but we can only do that inside the onMapCreated callback (after obtaining the MapboxMap instance).
However, this timing is too late: the initial network requests (style / glyph / sprite / tile) are already fired before setCustomHeaders done, so those first requests never include our custom headers.

We’d like to define custom headers before any Maps API object is constructed — similar to how we set the access token with MapboxOptions.setAccessToken(...).

Rationale

Some servers require custom auth headers for all map traffic

Enterprise / B2B applications often need to identify the app / org via headers

Prevents the “first request goes out without headers” problem

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions