Skip to content

Commit ad41928

Browse files
authored
Fixed web server listener action (#15)
1 parent c042f1f commit ad41928

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

src/components/web-server.ts

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -182,21 +182,26 @@ export class WebServer extends pulumi.ComponentResource {
182182
{ parent: this, dependsOn: [this.lb] },
183183
);
184184

185+
const defaultAction = this.certificate
186+
? {
187+
type: 'redirect',
188+
redirect: {
189+
port: '443',
190+
protocol: 'HTTPS',
191+
statusCode: 'HTTP_301',
192+
},
193+
}
194+
: {
195+
type: 'forward',
196+
targetGroupArn: lbTargetGroup.arn,
197+
};
198+
185199
const lbHttpListener = new aws.lb.Listener(
186200
`${this.name}-lb-listener-80`,
187201
{
188202
loadBalancerArn: lb.arn,
189203
port: 80,
190-
defaultActions: [
191-
{
192-
type: 'redirect',
193-
redirect: {
194-
port: '443',
195-
protocol: 'HTTPS',
196-
statusCode: 'HTTP_301',
197-
},
198-
},
199-
],
204+
defaultActions: [defaultAction],
200205
tags: commonTags,
201206
},
202207
{ parent: this },

0 commit comments

Comments
 (0)