I’m using the Nginx Ingress Controller in a Kubernetes cluster, and I’m using the URL rewriting functionality.
My question is, can I configure the controller to add a header containing the original request URL?
I’m thinking of a scenario where the underlying service needs to redirect to an external authentication service, which, upon success, would redirect again to the original ingress URL … but once the URL is rewritten, the underlying service doesn’t know what the original ingress URL was.
I’ve seen some suggestions involving configuration-snippet
, but this seems to have some pretty severe security implications.
I’ve tried using the x-forwarded-prefix
annotation, and that helps the underlying service to re-assemble the original URL when the rewrite is a simple “remove prefix” operation, but that won’t help when if a more complex rewrite is required.