Repository navigation
forward proxy with basic authorization redirects back to auth page #27647
|
hello, {
servers {
# temporary
log_credentials
}
}
http://192.168.100.125:4544 {
# directive execution order is only as stated if enclosed with route.
route {
# always forward outpost path to actual outpost
reverse_proxy /outpost.goauthentik.io/* http://192.168.100.125:9000
# forward authentication to outpost
forward_auth http://192.168.100.125:9000 {
uri /outpost.goauthentik.io/auth/caddy
# capitalization of the headers is important, otherwise they will be empty
copy_headers X-Authentik-Username X-Authentik-Groups X-Authentik-Entitlements X-Authentik-Email X-Authentik-Name X-Authentik-Uid X-Authentik-Jwt X-Authentik-Meta-Jwks X-Authentik-Meta-Outpost X-Authentik-Meta-Provider X-Authentik-Meta-App X-Authentik-Meta-Version Authorization
# Add the 'authorization' header to the list if you need proxy providers which
# send a custom HTTP-Basic Authentication header based on values from authentik
# optional, in this config trust all private ranges, should probably be set to the outposts IP
trusted_proxies private_ranges
}
# actual site configuration below, for example
respond "Hello World!"
}
}
it is pretty much the default curl -v -L --user '<username>' http://192.168.100.125:4544but all I get is a bunch on redirects ( I don't know if it's related but I host both caddy and authentik using docker (in different networks exposed to my local network at ports 4544 and 9000 respectively). They can clearly reach each other. let me know I should post my What did I miss? did I understand something incorrectly? how can I fix it? |
Replies: 1 comment 1 reply
|
With Caddy forward auth, a Basic credential that doesn't resolve gets a 302 to the login page, not a 401. That's why What the code does at
About the setting you asked about: "Send HTTP Basic authentication" only controls the header sent upstream to the app. It doesn't affect what the outpost accepts (header_authentication.mdx#L40), so it isn't your problem. To narrow it down:
Not tested: I did not run authentik or your Caddy setup, so the cause on your side is unconfirmed. The code paths above are from reading the source only. |

With Caddy forward auth, a Basic credential that doesn't resolve gets a 302 to the login page, not a 401. That's why
curl -Lends on a 200 login page. The account password never works for Basic auth; you need an app password.What the code does at
eebd7de7(main, not necessarily your release):check_auth, and if that fails it callsauth_start, which always returns a 302 to the authorize URL (forward.rs#L111-L122, mod.rs#L85-L127).redirect_to_start, which the Caddy path doesn't call (mod.rs#L142-L156). Only proxy mode reaches it (proxy.rs#L44). nginx returns 401 directly (forward.rs#L196). The docs say Basic failures retu…