Troubleshooting redirection issues with Authelia and Caddy

Moved from another post

This post was originally in reply to Securing web apps with Caddy and Authelia in Docker Compose: an opinionated, practical, and minimal production-ready login portal guide and has since been split into a new topic.

Hi - thank you very much for this post! exactly what I needed. I’m having an issue with redirecting after authentication and can’t figure out why.

followed your instructions to the T. when i go to lets say abc.example.com, login with credentials, it just stays there saying logged in. After this, if i go to abc.example.com its fine, but i can’t manage to get a redirect after authentication.

Any help will be much appreciated!

1 Like

I’m also running into this issue! After authenticating & providing my TOTP, Authelia remains at auth.example.com/2fa/one-time-password .

Keeping tabs on any replies received :slight_smile:

Hiya @cloudedhopes and @mrtcd,

Just want to double check to make sure that your session: domain: in Authelia’s configuration.yml is set to your root domain and not the subdomain? e.g. example.com and not auth.example.com nor abc.example.com?

1 Like

Hi @Whitestrake - i’m using duckdns.org, so I have session: and domain: as abc.duckdns.org.

also want to point out, since all my apps/services are running on the same host, using this :
(secure) {
forward_auth {args.0} app:9091 {
uri /api/verify?rd=https://auth.abc.duckdns.org
copy_headers Remote-User Remote-Groups Remote-Name Remote-Email
}
}
works fine, just wondering why the other isn’t working.

Anything in Authelia’s logs when you complete a login?

My session: domain: is set to the root domain - e.g. example.com

@cloudedhopes and @mrtcd if you two could just double check your docker compose logs app and see if Authelia is logging anything when you complete a login that might give us some clues as to why post-authentication redirection might not be occurring.

hi @Whitestrake - sorry for the delay. suddenly my Authelia is not working. I tried adding user in the users_database.yml. didn’t work. then i reverted to my previous users_database.yml and now getting this error:

time=“2023-09-15T22:34:28Z” level=info msg=“Authelia v4.37.5 is starting”
time=“2023-09-15T22:34:28Z” level=info msg=“Log severity set to info”
time=“2023-09-15T22:34:28Z” level=info msg=“Storage schema is being checked for updates”
time=“2023-09-15T22:34:28Z” level=info msg=“Storage schema is already up to date”
time=“2023-09-15T22:34:28Z” level=error msg=“Failure running the user provider startup check: error reading the authentication database: could not parse the YAML database: yaml: line 6: found character that cannot start any token” stack=“github.com/authelia/authelia/v4/internal/commands/root.go:287 doStartupChecks\ngithub.com/authelia/authelia/v4/internal/commands/root.go:87 cmdRootRun\ngithub.com/spf13/cobra@v1.6.1/command.go:920 (*Command).execute\ngithub.com/spf13/cobra@v1.6.1/command.go:1044 (*Command).ExecuteC\ngithub.com/spf13/cobra@v1.6.1/command.go:968 (*Command).Execute\ngithub.com/authelia/authelia/v4/cmd/authelia/main.go:10 main\nruntime/proc.go:250 main\nruntime/asm_amd64.s:1594 goexit”
time=“2023-09-15T22:34:28Z” level=fatal msg=“The following providers had fatal failures during startup: user” stack=“github.com/authelia/authelia/v4/internal/commands/root.go:309 doStartupChecks\ngithub.com/authelia/authelia/v4/internal/commands/root.go:87 cmdRootRun\ngithub.com/spf13/cobra@v1.6.1/command.go:920 (*Command).execute\ngithub.com/spf13/cobra@v1.6.1/command.go:1044 (*Command).ExecuteC\ngithub.com/spf13/cobra@v1.6.1/command.go:968 (*Command).Execute\ngithub.com/authelia/authelia/v4/cmd/authelia/main.go:10 main\nruntime/proc.go:250 main\nruntime/asm_amd64.s:1594 goexit”

so been busy trying to sort this out first. It was working until i tried adding the new user.

so NVM that problem, was because of error in the users_database.yml

I can’t figure out any issues in the caddy log files

I also don’t have any leads from the caddy logs or authelia logs, unfortunately

@cloudedhopes @mrtcd

Given that it’s just a broken redirect, and forward auth appears to be otherwise functional, I’m highly confident that Caddy isn’t being an issue here. I also don’t have the problem, so I don’t think I’m much help.

I’ll tag in @james_d_elliott to see if he’s got any other advice, but most likely I think you may need to troubleshoot Authelia.

Per Contact - Information - Authelia, the right place to do that is authelia/authelia · Discussions · GitHub or their Matrix/Discord.

1 Like

What was the error you had in your users_database.yml? I am getting the exact same errors you have but can’t figure it out what is wrong in my users_database.yml

I couldn’t figure it out, I think formatting issue? So I just used the default user_database and carefully edited it. I probably used a tab somewhere in the file. Hope this information helps you.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.