Allow CORS

This commit is contained in:
Alex Ling
2022-03-20 09:57:36 +00:00
parent 703e6d076b
commit 2091053221
5 changed files with 51 additions and 7 deletions
+4
View File
@@ -59,6 +59,10 @@ class AuthHandler < Kemal::Handler
end
def call(env)
# OPTIONS requests do not require authentication
if env.request.method === "OPTIONS"
return call_next(env)
end
# Skip all authentication if requesting /login, /logout, /api/login,
# or a static file
if request_path_startswith(env, ["/login", "/logout", "/api/login"]) ||