Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ion asset caching #6353

Merged
merged 2 commits into from
Mar 22, 2018
Merged

Fix ion asset caching #6353

merged 2 commits into from
Mar 22, 2018

Conversation

mramato
Copy link
Contributor

@mramato mramato commented Mar 21, 2018

ion asset caching was essentially broken because sending the access token in the query string would bust the cache. The initial fix was to allow the token in the Authorization header, which fixed caching but triggered a preflight request for every tile request (due to CORS), this adds unnecessary overhead. To work around this CORS limitation, the ion servers also support including the token in the Accept header, which is non-standard but perfectly legal and does not trigger a pre-flight.

Unfortunately, including token in the Accept header means we can no longer vary the accept header to handle terrain extensions. Cesium ion supports passing extensions via query parameters, so CesiumTerrainProvider now detects an ion resource and uses query parameters for them.

Also turned the private and static function Resource._makeRequest into a prototype function so that I could override it IonResource. This actually opens the way for some future simplification of IonResource, but that's definitely a separate PR.

CC @shunter @tfili

mramato added 2 commits March 20, 2018 20:31
ion asset caching was essentially broken because sending the access token
in the query string would bust the cache. The initial fix was to allow the
token in the Authorization header, which fixed caching but triggered a
preflight request for every tile request (due to CORS), this adds
unnecessary overhead. To work around this CORS limitation, the ion servers
also support including the token in the `Accept` header, which is
non-standard but perfectly legal and does not trigger a pre-flight.

Unfortunately, including token in the Accept header means we can no longer
vary the accept header to handle terrain extensions. Cesium ion supports
passing extensions via query parameters, so `CesiumTerrainProvider` now
detects an ion resource and uses query parameters for them.

Also turned the private and static function `Resource._makeRequest` into
a prototype function so that I could override it `IonResource`
@mramato
Copy link
Contributor Author

mramato commented Mar 22, 2018

@tfili bump

@tfili
Copy link
Contributor

tfili commented Mar 22, 2018

Looks good.

@tfili tfili merged commit 4e5f847 into master Mar 22, 2018
@tfili tfili deleted the ion-caching branch March 22, 2018 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants