Fix forward_auth in caddy, keep proxy open when run locally

This commit is contained in:
Roberto Alsina 2024-07-07 13:59:54 -03:00
parent 7dd5248a6e
commit 6bd98d6792
4 changed files with 12 additions and 2 deletions

View File

@ -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
}

View File

@ -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"})

View File

@ -23,6 +23,9 @@ get "/version" do
"#{version}"
end
get "/auth" do
end
get "/reload" do
Log.info { "Reloading configuration" }
Config.load

View File

@ -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
}