Well statically stripping a certain number of elements does indeed not seem "proper.
If you look at https://docs.ceph.com/en/latest/radosgw/keystone/#ocata-and-later vs https://docs.ceph.com/en/latest/radosgw/keystone/#cross-project-tenant-acces... the existence of "AUTH_$(project_id)s" cannot always be expected. But maybe a rule / regex can be found to strip optional version and AUTH element?
Kinda like ...
'(.*?)(/v[0-9](/AUTH_.+)?)?$'
to get all the path elements until the (optional) "v"ersion and an (optional) "AUTH_" at the end.
Honestly I don't know how the swift endpoint URLs looks like when deploying OpenStack Swift instead of Ceph RGW. But I suppose the endpoint has some potential variance in path there as well?
Precisely. I always strongly disliked cases where REST methods are exposed under non service catalog provided base. This is an ugly grave full of corpses.
Idea with regex sounds like a least bad for me. Eventually finding /v1 and getting one level above.