Skip to content

Commit

Permalink
Update ALB rules for app domains
Browse files Browse the repository at this point in the history
  • Loading branch information
farski committed Oct 23, 2023
1 parent c1be6cd commit b06aa0f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 24 deletions.
1 change: 1 addition & 0 deletions spire/templates/apps-300A.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ Resources:
CastlePostgresInstanceEndpointPort: !Ref CastlePostgresInstanceEndpointPort
CastlePostgresClientSecurityGroupId: !Ref CastlePostgresClientSecurityGroupId
AdFilesHostname: !Ref AdFilesHostname
AuguryHostname: !Ref AuguryHostname
FeederHostname: !Ref FeederHostname
IdHostname: !Ref IdHostname
CastleHostname: !Ref CastleHostname
Expand Down
15 changes: 11 additions & 4 deletions spire/templates/apps/augury.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ Parameters:
CastlePostgresInstanceEndpointPort: { Type: String }
CastlePostgresClientSecurityGroupId: { Type: String }
AdFilesHostname: { Type: String }
AuguryHostname: { Type: String }
FeederHostname: { Type: String }
IdHostname: { Type: String }
CastleHostname: { Type: String }
Expand Down Expand Up @@ -94,18 +95,24 @@ Resources:
- inventory.dovetail.*
ListenerArn: !Ref AlbHttpsListenerArn
Priority: !Join ["", [!Ref AlbListenerRulePriorityPrefix, "01"]]
AltHostHeaderListenerRule:
RedirectHostHeaderListenerRule:
Type: AWS::ElasticLoadBalancingV2::ListenerRule
Properties:
Actions:
- TargetGroupArn: !Ref TargetGroup
Type: forward
- RedirectConfig:
Host: !Ref AuguryHostname
Path: "/#{path}"
Port: "#{port}"
Protocol: "#{protocol}"
Query: "#{query}"
StatusCode: "HTTP_301"
Type: redirect
Conditions:
- Field: host-header
Values:
- augury.*
ListenerArn: !Ref AlbHttpsListenerArn
Priority: !Join ["", [!Ref AlbListenerRulePriorityPrefix, "02"]]
Priority: !Join ["", [!Ref AlbListenerRulePriorityPrefix, "03"]]

TargetGroup:
Type: AWS::ElasticLoadBalancingV2::TargetGroup
Expand Down
30 changes: 10 additions & 20 deletions spire/templates/apps/feeder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ Resources:
WebLoggedErrorsMetricName: !Sub WebLoggedErrors${EnvironmentType}
PublicFeedsUrlPrefix: !Sub https://${PublicFeedsHostname}/f

# The canonical address for this app is podcasts.dovetail.prx.org.
# API traffic to the old feeder.prx.org domain should continue to be handled
# directly.
# All other traffic to feeder.prx.org should redirect to the new domain.
HostHeaderListenerRule:
Type: AWS::ElasticLoadBalancingV2::ListenerRule
Properties:
Expand All @@ -94,21 +98,7 @@ Resources:
- podcasts.dovetail.*
ListenerArn: !Ref AlbHttpsListenerArn
Priority: !Join ["", [!Ref AlbListenerRulePriorityPrefix, "01"]]
AltHostHeaderListenerRule:
Type: AWS::ElasticLoadBalancingV2::ListenerRule
Condition: IsProduction
Properties:
Actions:
- TargetGroupArn: !Ref WebTargetGroup2
Type: forward
Conditions:
- Field: host-header
Values:
- feeder.*
ListenerArn: !Ref AlbHttpsListenerArn
Priority: !Join ["", [!Ref AlbListenerRulePriorityPrefix, "02"]]

Temp1ListenerRule:
LegacyApiWildcardListenerRule:
Type: AWS::ElasticLoadBalancingV2::ListenerRule
Condition: IsStaging
Properties:
Expand All @@ -123,8 +113,8 @@ Resources:
Values:
- /api/*
ListenerArn: !Ref AlbHttpsListenerArn
Priority: !Join ["", [!Ref AlbListenerRulePriorityPrefix, "07"]]
Temp3ListenerRule:
Priority: !Join ["", [!Ref AlbListenerRulePriorityPrefix, "20"]]
LegacyApiRootListenerRule:
Type: AWS::ElasticLoadBalancingV2::ListenerRule
Condition: IsStaging
Properties:
Expand All @@ -139,8 +129,8 @@ Resources:
Values:
- /api
ListenerArn: !Ref AlbHttpsListenerArn
Priority: !Join ["", [!Ref AlbListenerRulePriorityPrefix, "08"]]
Temp2ListenerRule:
Priority: !Join ["", [!Ref AlbListenerRulePriorityPrefix, "21"]]
LegacyRedirectListenerRule:
Type: AWS::ElasticLoadBalancingV2::ListenerRule
Condition: IsStaging
Properties:
Expand All @@ -158,7 +148,7 @@ Resources:
Values:
- feeder.*
ListenerArn: !Ref AlbHttpsListenerArn
Priority: !Join ["", [!Ref AlbListenerRulePriorityPrefix, "11"]]
Priority: !Join ["", [!Ref AlbListenerRulePriorityPrefix, "99"]]

DefaultJobQueue:
Type: AWS::SQS::Queue
Expand Down

0 comments on commit b06aa0f

Please sign in to comment.