diff --git a/config/Caddyfile b/config/Caddyfile index 1ebaa3e..7b91244 100644 --- a/config/Caddyfile +++ b/config/Caddyfile @@ -6,7 +6,7 @@ http://*:8888 { forward_auth /admin/* http://127.0.0.1:3000 { - uri http://127.0.0.1:3000 + uri /auth copy_headers { Authorization } diff --git a/src/daemon/config.cr b/src/daemon/config.cr index a20aba4..f45fb25 100644 --- a/src/daemon/config.cr +++ b/src/daemon/config.cr @@ -20,6 +20,13 @@ class Config end class ConfigAuthHandler < Kemal::BasicAuth::Handler + only ["/auth"] + + def call(context) + return call_next(context) unless only_match?(context) + super + end + def initialize # Ignored, just make the compiler happy @credentials = Kemal::BasicAuth::Credentials.new({"foo" => "bar"}) diff --git a/src/daemon/main.cr b/src/daemon/main.cr index 27eaf4d..f76d08b 100644 --- a/src/daemon/main.cr +++ b/src/daemon/main.cr @@ -23,6 +23,9 @@ get "/version" do "#{version}" end +get "/auth" do +end + get "/reload" do Log.info { "Reloading configuration" } Config.load diff --git a/src/daemon/proxy.cr b/src/daemon/proxy.cr index 81c76bc..cbb3d6f 100644 --- a/src/daemon/proxy.cr +++ b/src/daemon/proxy.cr @@ -37,7 +37,7 @@ module Proxy http://*:8888 { forward_auth /admin/* http://127.0.0.1:3000 { - uri http://127.0.0.1:3000 + uri /auth copy_headers { Authorization }