]> git.openstreetmap.org Git - nominatim.git/blobdiff - nominatim/server/starlette/server.py
allow to add php-compatible endpoints
[nominatim.git] / nominatim / server / starlette / server.py
index dfbdc50290eae1230f36b5ba6b35ad8de6b256e1..de9a3f87965e1b53e8649e2cd2713b1b748d38f3 100644 (file)
@@ -61,8 +61,12 @@ def get_application(project_dir: Path,
     config = Configuration(project_dir, environ)
 
     routes = []
+    legacy_urls = config.get_bool('SERVE_LEGACY_URLS')
     for name, func in api_impl.ROUTES:
-        routes.append(Route(f"/{name}", endpoint=_wrap_endpoint(func)))
+        endpoint = _wrap_endpoint(func)
+        routes.append(Route(f"/{name}", endpoint=endpoint))
+        if legacy_urls:
+            routes.append(Route(f"/{name}.php", endpoint=endpoint))
 
     middleware = []
     if config.get_bool('CORS_NOACCESSCONTROL'):