Authelia: Automatic Redirection Not Working After Login on Traefik2

Created on 22 Sep 2020  路  7Comments  路  Source: authelia/authelia

_This is a followup on issue #1332_

As mentioned in the above issue, post-login redirection is not working properly after login.

Full docker-compose proof of concept attached. Also running at app1.authelia-1322.yanke.io (please check this soon though, as I have it on a dedicated VPS I'd like to clean up shortly).

proof-of-concept.tar.gz

Note that after logging in with example/password, you are redirected to $authelia/authenticated, instead of back to the app.

Integration Issue Question

All 7 comments

Thanks for providing this @benyanke.

Could you try changing line 69 of your docker-compose.yaml as follows and test again please?

From: - 'traefik.http.middlewares.auth.forwardauth.address=https://login.authelia-1322.yanke.io/api/verify?rd=https://login.authelia-1322.yanke.io/'

To: - 'traefik.http.middlewares.auth.forwardauth.address=http://authelia:9091/api/verify?rd=https://login.authelia-1322.yanke.io/'

Sure, I can try later today.

Is it a requirement to use the internal network? I was hoping to be able to use this across clusters where the other consumers wouldn't have internal docker level access like that.

That config change resolved it (try the app above to confirm). As in the comment above, is there any workaround for using the out-of-docker networking for these checks, while still supporting this redirect?

You would need to expose Authelia at the host level instead of using in docker networks and point your forwardauth to said IP address or internal dns hostname.

Traefik's forwardauth needs to speak directly to Authelia as opposed to a brokered termination through the reverse proxy (itself).

Hm, interesting. Do you have any more details on why that is?

Other than manually specifying the header, is there any known workarounds?

I'm speaking purely from experience here.

I haven't personally tried your use case where a separate instance of Traefik or another reverse proxy is utilising a reverse proxied instance of Authelia as the forward auth source, presumably this SHOULD work.
The specific instance where I saw this was an issue was if it was the same instance of Traefik self-terminating.

I'd suggest you try your use case and see if it works, it might actually work.

Ok. Fair enough. As I dive in further with this, I may revisit this issue with more questions, or open more specific issues. In any case, thanks for the brainstorming and answering questions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

davama picture davama  路  9Comments

leveled picture leveled  路  7Comments

jkaberg picture jkaberg  路  6Comments

zjzeit picture zjzeit  路  3Comments

zjzeit picture zjzeit  路  3Comments