HTTP redirect is a feature provided by ALB. It will directly return a 30x HTTP code for the request that matches the rule. The Location header will be used to instruct the client to redirect to the new URL.
ALB supports redirect configuration at the port and rule levels.
Redirect could be configured on:
.spec.config.redirect
.spec.config.redirect
Annotation | Description |
---|---|
nginx.ingress.kubernetes.io/permanent-redirect | Corresponds to URL in CR, will set code to 301 by default |
nginx.ingress.kubernetes.io/permanent-redirect-code | Corresponds to code in CR |
nginx.ingress.kubernetes.io/temporal-redirect | Corresponds to URL in CR, will set code to 302 by default |
nginx.ingress.kubernetes.io/temporal-redirect-code | Corresponds to code in CR |
nginx.ingress.kubernetes.io/ssl-redirect | Corresponds to scheme in CR, will set scheme to HTTPS by default |
nginx.ingress.kubernetes.io/force-ssl-redirect | Corresponds to scheme in CR, will set scheme to HTTPS by default |
When redirect is configured at the port level, all requests to this port will be redirected according to the redirect configuration.
When redirect is configured at the rule level, the request matching this rule will be redirected according to the redirect configuration.