The $request_uri nginx variable does already contain a slash at the beginning if a path part is present in the request URL. For that reason, the proper configuration for the nginx.ingress.kubernetes.io/auth-url would rather look like http://<heimdall service name>.<namespace>.svc.cluster.local:<decision port>$request_uri (no slash before $request_uri ). Nevertheless, the example above makes use of that variable by adding yet another slash in front of it. This is required due to a bug in the nginx ingress controller implementation, which fails to parse an nginx template of the form http://heimdall:4456$request_uri (no slash after the port part), resulting in the following error Location denied. Reason: "could not parse auth-url annotation: http://some-service.namespace.svc.cluster.local:4456$request_uri is not a valid URL: parse \"http://some-service.namespace.svc.cluster.local:4456$request_uri\": invalid port \":4456$request_uri\" after host"
With that additional slash however, all requests to heimdall will have a duplicate slash (e.g. //test ) in the URL path part if the path part is present. If the path part is absent, that is, the value of the $request_uri is empty, there is still one slash, so that e.g. a request to https://my-domain:80 will result in e.g. the following url for communication with heimdall: https://heimdall:4456/ Heimdall has an automatic workaround for that: if the call is done by the nginx ingress controller and there is // as suffix in the path, the first slash is removed. There is however no possibility to fix that for requests without the path part (see above). If this is an issue in your context, consider using the integration option described below. |