OpenSeaMap / online_chart

OpenSeaMap fullscreen browser chart.
http://map.openseamap.org/
64 stars 32 forks source link

the wikipedia layer does not work #143

Closed stevo01 closed 4 years ago

stevo01 commented 4 years ago

sample: https://map.openseamap.org/?zoom=10&lat=49.48953&lon=11.22642&layers=BFTFFFTFFTT0FFFFFFFFFF

stevo01 commented 4 years ago

api/proxy-wikipedia.php seems to be responsible to fetch data from https://tools.wmflabs.org/

a manual call of "https://map.openseamap.org/api/proxy-wikipedia.php" shows image

stevo01 commented 4 years ago

analysis in webbrowser shows that url "https://tools.wmflabs.org/wp-world/marks.php" is redirected to "https://wp-world.toolforge.org/marks.php "

the following patch is a workaround for the problem:

diff --git a/api/proxy-wikipedia.php b/api/proxy-wikipedia.php
index e99eae5..487ac52 100644
--- a/api/proxy-wikipedia.php
+++ b/api/proxy-wikipedia.php
@@ -2,11 +2,11 @@
 // PHP Proxy for map.openseamap.org to reach the wmflabs tool server

 // Allowed hostname (api.local and api.travel are also possible here)
-define ('HOSTNAME', 'https://tools.wmflabs.org/');
+define ('HOSTNAME', 'https://wp-world.toolforge.org/');

 // Get the REST call path from the AJAX application
 // Is it a POST or a GET?
-$path = "wp-world/marks.php?LANG=".htmlspecialchars($_GET["LANG"]) .
+$path = "marks.php?LANG=".htmlspecialchars($_GET["LANG"]) .
     "&thumbs=".htmlspecialchars($_GET["thumbs"]) .
         "&bbox=".htmlspecialchars($_GET["bbox"]) ;`

Proposal: make the php code more robust and follow redirections ...

aAXEe commented 4 years ago

Thanks a lot @stevo01.

Proposal: make the php code more robust and follow redirections ...

Of course a good idea but do we realy (still) need this proxy script? With modern javascript we should do the request directly from the users browser and get data directly. CORS needs to be configured properly at the destination server to allow this.

stevo01 commented 4 years ago

Thanks a lot @stevo01.

Proposal: make the php code more robust and follow redirections ...

Of course a good idea but do we realy (still) need this proxy script? With modern javascript we should do the request directly from the users browser and get data directly. CORS needs to be configured properly at the destination server to allow this.

I totally agree. We should not waste time with beautification of the php code ...