HTTP Redirect
TOC
Basic Concept
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.
CRD
Redirect could be configured on:
- Frontend:
.spec.config.redirect - Rule:
.spec.config.redirect
Ingress Annotation
SSL-Redirect
- SSL-redirect and force-ssl-redirect differ in that SSL-redirect only takes effect when the ingress has a certificate for the corresponding domain, while force-ssl-redirect takes effect regardless of whether there is a certificate.
- For HTTPS ports, if only SSL-redirect is configured, the redirect will not be set.
Port Level Redirect
When redirect is configured at the port level, all requests to this port will be redirected according to the redirect configuration.
Rule Level Redirect
When redirect is configured at the rule level, the request matching this rule will be redirected according to the redirect configuration.