Skip to content

Instantly share code, notes, and snippets.

@unbelauscht
Created August 5, 2021 14:54
Show Gist options
  • Save unbelauscht/19cd20ade518a8e7fe907fb91b83007c to your computer and use it in GitHub Desktop.
Save unbelauscht/19cd20ade518a8e7fe907fb91b83007c to your computer and use it in GitHub Desktop.
Redirect URL on AWS LB
# https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb_listener_rule#path_pattern
resource "aws_lb_listener_rule" "redirect" {
listener_arn = aws_lb_listener.listener.arn
action {
type = "redirect"
redirect {
port = "443"
protocol = "HTTPS"
path = "/new_url"
status_code = "HTTP_302"
}
}
condition {
path_pattern {
values = ["/old_url"]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment