Skip to content
This repository has been archived by the owner on Jul 24, 2021. It is now read-only.

API should honour conditional If-Modified-Since HTTP GET #579

Closed
openstreetmap-trac opened this issue Jul 23, 2021 · 3 comments
Closed

API should honour conditional If-Modified-Since HTTP GET #579

openstreetmap-trac opened this issue Jul 23, 2021 · 3 comments

Comments

@openstreetmap-trac
Copy link

Reporter: openstreetmap[at]firefishy.com
[Submitted to the original trac issue database at 9.52am, Wednesday, 31st October 2007]

As cheaply as possible the API should honour conditional If-Modified-Since HTTP GET. (Maybe initially only on: /api/0.5/map?bbox=)

If-Modified-Since header definition:
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.25

Rails Code example:
http://www.igvita.com/blog/2007/03/07/client-http-caching-in-rails/

This would allow more intelligence in downstream clients. Eg: TilesAtHome having the ability to only run a full API map GET request and re-render if the tile/area has actually been modified.

This paves the way for "freshness" validated caching.

Blocked By: Bug #578

@openstreetmap-trac
Copy link
Author

Author: tom[at]compton.nu
[Added to the original trac issue at 10.46am, Wednesday, 31st October 2007]

Now you're just taking the piss! There is no way on earth that this is likely to get done anytime soon...

@openstreetmap-trac
Copy link
Author

Author: openstreetmap[at]firefishy.com
[Added to the original trac issue at 5.14pm, Wednesday, 31st October 2007]

Apologies if I am being loon. Resolve -> wontfix is suitable then.

OK, working out when a ways or relations within a bounding box has changed is difficult (and costly)

How about the following...

Create new db table storing last modified time of layer 12 tiles. Kept updated by using a mysql trigger on db tables; current_nodes, current_way_nodes and current_relation_members.

On a API map request without an If-Modified-Since: the bounding box is normalised to find the layer 12 tiles it applies to, selecting the MAX modified time and using this as the Last-Modified time.

On a API map request with an If-Modified-Since: If-Modified-Since time is compared to bounding box layer 12 tiles' MAX modified time. If MAX modified time <= If-Modified-Since short circuit ELSE proceed with normal request.

Shared proxy-cache in front of web would result in most request being If-Modified-Since conditional request. Rounding bounding boxes requests up to semi standard sizes could result in worthwhile cache hits.

Conditional GET Usage example:

  • T@H client downloads map (layer 12) and renders, storing Last-Modified time returned by API, subsequent T@H client API Map download of that tile would be If-Modified-Since conditional based request using previous stored Last-Modified time.

@openstreetmap-trac
Copy link
Author

Author: iandees
[Added to the original trac issue at 10.37pm, Monday, 9th September 2013]

The API will have to work just as hard to check modification dates as it would to return the entire result.

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

No branches or pull requests

1 participant