I am working with Traefik v3 deployed on Kubernetes via the Helm chart and configured with the CRD types.
I have a simplified system in which I have a single IngressRoute
defined against hostname
.
If I configure the redirectScheme
middleware as below when I query the hostname
I expect to get a 301 redirect response, instead I get a 404 not found.
If I remove the middleware then I am served my underlying service.
Can anyone explain why the redirectScheme
does not appear to be working?
const httpsOnly = new traefik.v1alpha1.Middleware(
'https-only',
{
apiVersion: 'traefik.io/v1alpha1',
kind: 'Middleware',
metadata: { name: 'https-only', namespace },
spec: {
redirectScheme: {
scheme: 'https',
permanent: true,
},
},
},
{ provider },
);
new traefik.v1alpha1.IngressRoute(
'redirect-route',
{
apiVersion: 'traefik.io/v1alpha1',
kind: 'IngressRoute',
metadata: {
name: 'redirect-route',
namespace,
},
spec: {
entryPoints: ['web'],
routes: [
{
kind: 'Rule',
match: pulumi.interpolate`Host(\`${hostname}\`)`,
services: [
{
name: myService.metadata.name,
port: 80,
},
],
middlewares: [{ name: mustGetMetadataName(httpsOnly) }],
},
],
},
},
{ provider },
);