Skip to content

Performance: Use 'If-Modified-Since' header when re-requesting expired tiles #5799

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

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

NathanMOlson
Copy link
Contributor

When a tile expires, it is re-requested. Before this PR, it is always transferred over the network. After this PR, the If-Modified-Since header is set in the re-request, so the server can send a 304 Not Modified response if the tile has not been modified, instead of resending the tile.

This is primarily intended for use with tiles that have a very short expiration time (<10 seconds). This could be useful when the underlying data is changing rapidly.

  • Confirm your changes do not include backports from Mapbox projects (unless with compliant license) - if you are not sure about this, please ask!
  • Briefly describe the changes in this PR.
  • Link to related issues.
  • Implement for raster tile source.
  • Extend to all tile sources (vector, raster-dem).
  • Write tests for all new functionality.
  • Add an entry to CHANGELOG.md under the ## main section.

@NathanMOlson NathanMOlson marked this pull request as draft April 23, 2025 23:21
@HarelM
Copy link
Collaborator

HarelM commented Apr 24, 2025

Overall, this is a good idea.
The complexity of data flow and handling of different response types is what you should be looking out for though (for example 404 overzooming, etc...).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants