mirror of
https://github.com/yusing/godoxy.git
synced 2026-01-14 06:13:33 +01:00
OIDC with Cloudflare proxied domains #48
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @reddwarf666 on GitHub (Mar 19, 2025).
Hi There!
We had some conversation 1 month ago and I chose to stay with NPM. https://github.com/yusing/godoxy/issues/66
I had Pocket-ID working finally but I was not completely happy with it as I find having only passkey a bit limiting and I had to create a setup where every container I wanted to protect with Pocket-ID needed a separate instance of OAuth2-Proxy. Not a solid setup I think.
Started to look at Keycloak to replace Pocket-ID and my issues in this regard with NPM were bad. So bad that I thought to abandon NPM.
Thought about Godoxy again and wanted to give it a second chance!
Did all you said I had to do and I have Godoxy running. Easy, simple and I like it! Thanks for the push at the time, it made the transition easier.
Before I continue with the issue I have with using Keycloak as OIDC provider, I collected some thoughts and things I encounter.
I don't want to overload this thread with several things and wondered if you want me to create separate issues or dump them in this thread?
Now the Keycloak issue I face. I have it running and I "think" I have it setup OK.
But once I try to make Keycloak the OIDC provider for Godoxy, I face some problem. The log of Godoxy does not tell me enough to hunt and fix this alone so I need your help with this.
Error in Godoxy log
Note: I could not find any errors in the
entrypoint.log. I cleared it and started Godoxy to make sure I did not miss anything but it remains empty after starting Godoxy. I guess this issue is so soon that logs are not written to.Here is some information you might need. I redacted where needed for privacy reasons.
Config for route to Keycloak (file called
keycloak.ymlstored in /config):(Note: host IP address here is the internal docker host IP address)
Config in .env for OIDC:
Config relevant I think from Keycloak compose file:
KC_HOSTNAME: auth.example.com
KC_PROXY_HEADERS: xforwarded
Perhaps related, not quite sure:
https://github.com/keycloak/keycloak/issues/31168#issuecomment-2222593574
And I wanted to mention this as it might be relevant.
When I started Keycloak for my Godoxy setup I could hardly logon to Keycloak
https://auth.example.com/admin/master/console/9 out of 10 times that failed with some weird non-descript error in the browser:
(I'm not making this up 😀!)
I read the Keycloak docs and found this:
Using a reverse proxy
https://www.keycloak.org/server/hostname
Hence I set this on my route for “auth”:
This worked really well...until I faced that OIDC issue and then this came back, I can hardly logon to Keycloak again, same weird message.
Any ideas what could be wrong or what to do here?
@yusing commented on GitHub (Mar 19, 2025):
I've just tested KeyCloak with following docker compose, I can login to Keycloak without issue but not able to setup OIDC either. My suggestion is try to use Authentik instead.
@reddwarf666 commented on GitHub (Mar 19, 2025):
Ok, thanks. I will look into Authentik.
By the way, I was looking around and stumbled across this:
https://github.com/vouch/vouch-proxy/blob/master/config/config.yml_example_gitea
Would that work for Godoxy? I mean, I have Gitea running in my setup so... 😀
@yusing commented on GitHub (Mar 19, 2025):
Actually I'm not sure why you want things like OAuth2-Proxy and vouch.
You can simpily set these environment variables and then enable oidc middleware per app like this:
@reddwarf666 commented on GitHub (Mar 19, 2025):
Oh, not wanting it, I was just surprised Gitea could be used as a OIDC.
I will go with what you support and Godoxy supports. And I saw in the docs Godoxy supports Authentik so I will see where that takes me.
@reddwarf666 commented on GitHub (Mar 20, 2025):
Ok, I have Authentik running! Yay!
However, I could logon/start with the URL: https://auth.example.com/if/flow/initial-setup/
But I could access Authentic via the internal docker host address: http://docker_host:9000/if/flow/initial-setup/
So I can also see now : http://docker_host:9000/if/admin/#/administration/overview
I could create a new user, disable the default admin, logon with my new account. All looks well.
The message in a browser:
Request failed. Please try again laterMy route file in Godoxy:
Is there anything I need to look at from Godoxy point of view?
@yusing commented on GitHub (Mar 20, 2025):
Remove the
set_x_forwardedmiddleware and try againAre you running authentik LXC or docker btw?
@reddwarf666 commented on GitHub (Mar 20, 2025):
Thanks. Tried that just now and get the same error. I thought to add that setting as in other solutions it was needed I think to set it. I'm running Authentik in Docker.
I was wondering about 3 things in the Authentik setup:
1)
AUTHENTIK_COOKIE_DOMAINWould I need to set that?
I had it set to
example.cominitially and got the same message. Then commented it out but same result.Perhaps setting it to
auth.example.comis needed?2)
I saw some config from Brokenscripts where it was set like so:
Would that make sense?
3)
This one seems to make a lot of sense somehow.
Perhaps you can have an idea about these and if they are needed?
@yusing commented on GitHub (Mar 20, 2025):
For docker containers, you should use docker labels instead of route files. If you want to use it in a NPM way (create routes manually on WebUI), enable explicit mode like this to avoid route conflicts:
I'm not sure why you have got into that error. Let me give you an example docker compose file for authentik (basically default
compose.ymlwith three labels added) and the.envfile:So basically the default docker compose and dotenv should work, without those stuff you have mentioned above.
@reddwarf666 commented on GitHub (Mar 20, 2025):
Thanks for the help!
Applied all you suggested to my setup and still face that issue.
Welp, now I will delete everything Authentik I did and start new with your suggestions, clean slate.
I will report back!
@reddwarf666 commented on GitHub (Mar 20, 2025):
One more thing, if you try this setup from scratch, do you start docker compose as root?
I run it as myself (1000:1000) so I wanted to make sure if this is done the same as you did.
@reddwarf666 commented on GitHub (Mar 20, 2025):
Ok, I took the sample you gave and and replaced only the REDACTED parts with my info, like passwords and so on.
Deleted all folders and files I had and started
docker compose up -dSame result unfortunately. "Request failed. Please try again later."
As the ports are not exposed in the compose file I could also not access Authentik locally, but that is understandable.
I think there is something not right in routing via the labels, as if something is missing or something like that.
But then again, I do get a screen from Authentic so it must be reachable, just not able to log on and start the initial process.
https://auth.example.com/if/flow/initial-setup/Any ideas? I feel I'm so, so close...
@yusing commented on GitHub (Mar 20, 2025):
I've just tried to setup from scratch, as myself (1000). I cannot reproduce the error, it just worked...
Could you check for the logs from those authentik containers when you hit
https://auth.example.com/if/flow/initial-setup/? Also network logs from browser's DevTools.@reddwarf666 commented on GitHub (Mar 20, 2025):
I saw some HTTPS authentication issues I think
The logs are available: https://we.tl/t-esv0Xe31Cl
Thanks!
@yusing commented on GitHub (Mar 21, 2025):
That's weird. Updated the docker compose above, added a redirectHTTP middleware, see if it works for you.
@reddwarf666 commented on GitHub (Mar 21, 2025):
Now I see another message when I try
https://auth.example.com/if/flow/initial-setup/Chrome:
Firefox:
From the network tab in developer mode:
And just before that message/row:
Screenshot of that window:

@reddwarf666 commented on GitHub (Mar 21, 2025):
And Godoxy just went crazy active and weird, have to restart that service:
@yusing commented on GitHub (Mar 21, 2025):
A few more questions:
compose.yml,.env,config/config.yml@reddwarf666 commented on GitHub (Mar 21, 2025):
I can in a moment, restarted the whole server.
And I have no issues sharing but I would rather send everything to you personally then here.
Does github have a message feature?
Edit: GoDoxy version v0.9.9-1
@yusing commented on GitHub (Mar 21, 2025):
DM me on discord yusing#1154
@reddwarf666 commented on GitHub (Mar 21, 2025):
For anybody seeing this thread and facing a similar issue
It was Cloudflare that proxied my DNS records by default when I imported my DNS records at the time.
After turning CF proxy to off on relevant A records it started to work!
Huge thanks to @yusing for helping me out here and discovering this issue. Went above and beyond I would say.
Note : and although this thread became one about Authentik, no Keycloak, I suspect that the issues I faced at the time were very similar and related to CF proxy settings on DNS A records.