osm-fr / osmose-frontend

Part of osmose that shows results on the website http://osmose.openstreetmap.fr
GNU General Public License v3.0
41 stars 38 forks source link

Vector tiles : 404 has no CORS headers in response #278

Closed PanierAvide closed 3 years ago

PanierAvide commented 3 years ago

Hello,

We use with Mapbox GL the Osmose tiles on projetdumois.fr. When a vector tile has no data, current code send a HTTP 404 status. But the response doesn't contain any CORS header, making client span a lot of errors :

Capture d’écran_2020-09-29_09-08-59

Example request : https://osmose.openstreetmap.fr/api/0.3/issues/10/504/352.mvt?item=8370&country=france*

HTTP response headers :

HTTP/2 404 Not Found
server: nginx/1.19.1
date: Tue, 29 Sep 2020 07:09:25 GMT
content-type: text/plain
content-length: 0
X-Firefox-Spdy: h2

Would it be possible either :

Best regards.

frodrigo commented 3 years ago

The right thing to do is to send a "204 No Content". https://github.com/osm-fr/osmose-frontend/blob/master/api/issues_tiles.py#L123