Kratos sessions have a location property. However looking at the source code this only works based on Cloudflare’s location headers. Is there any way this can be set if you aren’t proxying through Cloudflare (requiring Cloudflare for it to work seems a bit limiting)? Is there a webhook I can hook into so I can use, for example, maxmind’s database, to insert the location? Or some other approach? Cheers
I think we just went with cloudflare headers as a "standard" to start with
not sure if there are that many providers out there, so if we should just accept the headers from any well-known provider
alternatively, we could require you to rewrite the headers, or make the header name configurable
wdyt?
d
dazzling-napkin-4938
07/19/2024, 6:15 AM
yeah good point. I think the approach is right - Kratos accepts the header from something upstream. I don’t know what Google Cloud Platform has, but you’ve got Cloudflare and Cloudfront that add their own headers. If you are using nginx as a reverse proxy you can use the geoip module, but you can forward headers to kratos however you want.
From developer experience I think kratos supporting the couple of popular services out of the box would be nice. For custom, I think either Ory saying “You need to set this header for location to be recorded”, or “Configure the location header in config.yml” are about equal
s
steep-lamp-91158
07/19/2024, 7:44 AM
I agree, as we already support cloudflare, I see no reason why we should not support other common providers.
Open for contributions 😉
d
dazzling-napkin-4938
07/21/2024, 11:34 PM
on that note - is there documentation about the general structure/design of Kratos’s source code? I’ve snooped around in the code a bunch but I don’t have heaps of experience working with Go
s
steep-lamp-91158
07/22/2024, 7:46 AM
hm no not really, there are also parts that are in need of refactoring (as always everywhere)
if you search for the headers, you should find the strings and where they are used