Skip to content

Commit a73644a

Browse files
author
Matthias Alt
authored
Merge pull request #10 from solutionDrive/enable-https-by-default
Changes the port 80 listener to have a default action that redirects …
2 parents 42a322b + dcc3f2a commit a73644a

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ application-cluster in different code bases!
1111
1. LoadBalancer
1212

1313
Resources for a LoadBalancer (default: ApplicationLoadBalancer) with
14-
1 Listener for Port 80
14+
1 Listener for Port 80 (the default action is to redirect to https)
1515
1 Listener for Port 443 (An AWS-certificate is mandatory for this at the moment)
1616
1 Default Target Group (needed to define a listener)
1717

loadbalancer/loadbalancer.tf

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,13 @@ resource "aws_lb_listener" "loadbalancer_listener" {
2424
protocol = "HTTP"
2525

2626
default_action {
27-
target_group_arn = "${aws_lb_target_group.loadbalancer_default_target_group.arn}"
28-
type = "forward"
27+
type = "redirect"
28+
29+
redirect {
30+
port = "443"
31+
protocol = "HTTPS"
32+
status_code = "HTTP_301"
33+
}
2934
}
3035
}
3136

0 commit comments

Comments
 (0)