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

Default map provider (maps.wikimedia.org) tile requests are returning HTTP 403 response codes. #567

Closed
Dukestep opened this issue Nov 6, 2020 · 3 comments · Fixed by OSGeo/OSGeoLive#290
Labels
bug Something isn't working

Comments

@Dukestep
Copy link

Dukestep commented Nov 6, 2020

Description
The default map provider (https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png) is returning a 403 forbidden status code when displaying items via the HTML UI.

Steps to Reproduce
https://demo.pygeoapi.io/master/collections/lakes/items

Behaviour is also reproduced on a completely different private instance.

Expected behavior
Tiles requests should be returning 200 OK code.

Environment

  • OS: Not applicable
  • Python version: Not applicable
  • pygeoapi version: master

According to their Terms of Use:

Using maps in third-party services

If you use the Wikimedia Maps service for your third-party project (that is, outside of the Wikimedia projects), 
please respect our limited services and resources. We reserve the right to discontinue or change our service, 
block or limit certain users or applications, or take other measures in cases at our sole discretion 
at any time without notice. If you use the service too heavily, it could affect the service's stability for 
others or degrade our quality of service.

If you are developing an application that uses the Wikimedia Maps service, you must provide a valid HTTP 
User-Agent that includes your application, version, and sufficient information to easily contact you 
(e.g., your email address).

The following are prohibited on the Wikimedia Maps service:

    - Excessive downloading (such as downloading significant areas of tiles for later offline usage)
    - Accessing the service without a proper HTTP User-Agent or HTTP referer
    - Using the service without compliance with any license or copyright terms

It seems like we access the service with a valid HTTP referer but may fall in the "use the service too heavily" category?

@Dukestep Dukestep added the bug Something isn't working label Nov 6, 2020
@Dukestep Dukestep changed the title Default maps.wikimedia.org tile requests are returning HTTP 403 response codes. Default map provider (maps.wikimedia.org) tile requests are returning HTTP 403 response codes. Nov 6, 2020
@jasonwhitedev
Copy link

Gives out this error for the missing tiles/pngs:
Error: 403, Forbidden: Map tiles are restricted to Wikimedia & affiliated sites only. Please post on https://phabricator.wikimedia.org/T261694 if you believe your usage supports the Movement. at Tue, 10 Nov 2020 11:48:34 GMT

As mentioned, someone probably needs to go & do this:

If you are developing an application that uses the Wikimedia Maps service, you must provide a valid HTTP 
User-Agent that includes your application, version, and sufficient information to easily contact you 
(e.g., your email address).

@justb4
Copy link
Member

justb4 commented Nov 10, 2020

@jasonwhitedev good to bring up! pygeoapi (HTML view) already migrated from using OSM tiles from tile.openstreetmap.org (which half of the world still is using) to Wikimedia OSM Tiles, not aware of these (recent?) restrictions.

The pygeoapi HTML view mainly uses a Leaflet-map with a tile-url. Not sure how/where we can configure an HTTP User-Agent as a custom HTTP-header in Leaflet. May be possible with some interception. See e.g. for auth:
https://stackoverflow.com/questions/43946257/how-can-we-add-a-request-header-in-leaflet-tile-layer-wms-request

Another option is to use a tile-proxy/caching component like MapProxy which allows to configure custom HTTP-headers including referrers.

@doublebyte1
Copy link
Contributor

I addressed this on this PR:
#697

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants