From: Sarah Hoffmann Date: Tue, 1 Aug 2023 09:12:36 +0000 (+0200) Subject: allow OPTIONS method in starlette CORS middleware X-Git-Tag: v4.3.0~44 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/d15f6051293251d60d598a25c89e8fc5b6f75d4b?hp=--cc allow OPTIONS method in starlette CORS middleware If not allowed, then the middleware will return a 400 on pre-flight CORS requests. Fixes #3129. --- d15f6051293251d60d598a25c89e8fc5b6f75d4b diff --git a/nominatim/server/starlette/server.py b/nominatim/server/starlette/server.py index 2bcc8df5..f89e52a1 100644 --- a/nominatim/server/starlette/server.py +++ b/nominatim/server/starlette/server.py @@ -114,7 +114,10 @@ def get_application(project_dir: Path, middleware = [] if config.get_bool('CORS_NOACCESSCONTROL'): - middleware.append(Middleware(CORSMiddleware, allow_origins=['*'])) + middleware.append(Middleware(CORSMiddleware, + allow_origins=['*'], + allow_methods=['GET', 'OPTIONS'], + max_age=86400)) log_file = config.LOG_FILE if log_file: