Amazon web services AWS ALB路由-未找到请求的url
我有一个专门作为网站管理区前端的微服务。微服务有一个专用于它的路由/admin。这给了我一个404错误,当我试图访问。下面给出的是微服务云模板的摘录Amazon web services AWS ALB路由-未找到请求的url,amazon-web-services,aws-application-load-balancer,Amazon Web Services,Aws Application Load Balancer,我有一个专门作为网站管理区前端的微服务。微服务有一个专用于它的路由/admin。这给了我一个404错误,当我试图访问。下面给出的是微服务云模板的摘录 Resources: Service: Type: AWS::ECS::Service DependsOn: ListenerRule Properties: Cluster: !Ref Cluster Role: !Ref ServiceRole DesiredCount: !Ref
Resources:
Service:
Type: AWS::ECS::Service
DependsOn: ListenerRule
Properties:
Cluster: !Ref Cluster
Role: !Ref ServiceRole
DesiredCount: !Ref DesiredCount
TaskDefinition: !Ref TaskDefinition
LoadBalancers:
- ContainerName: "activity-monitor-service"
ContainerPort: 80
TargetGroupArn: !Ref TargetGroup
TaskDefinition:
Type: AWS::ECS::TaskDefinition
Properties:
Family: activity-monitor-service
ContainerDefinitions:
- Name: activity-monitor-service
Essential: true
Image: registry.hub.docker.com/abameerdeen/activity_monitor:v4
Memory: 128
Environment:
- Name: PRODUCT_SERVICE_URL
Value: !Ref ProductServiceUrl
PortMappings:
- ContainerPort: 80
LogConfiguration:
LogDriver: awslogs
Options:
awslogs-group: !Ref CloudWatchLogsGroup
awslogs-region: !Ref AWS::Region
CloudWatchLogsGroup:
Type: AWS::Logs::LogGroup
Properties:
LogGroupName: !Ref AWS::StackName
RetentionInDays: 365
TargetGroup:
Type: AWS::ElasticLoadBalancingV2::TargetGroup
Properties:
VpcId: !Ref VPC
Port: 80
Protocol: HTTP
Matcher:
HttpCode: 200-299
HealthCheckIntervalSeconds: 10
HealthCheckPath: /test.html
HealthCheckProtocol: HTTP
HealthCheckTimeoutSeconds: 5
HealthyThresholdCount: 2
ListenerRule:
Type: AWS::ElasticLoadBalancingV2::ListenerRule
Properties:
ListenerArn: !Ref Listener
Priority: 2
Conditions:
- Field: path-pattern
Values: [ "/admin/*" ]
Actions:
- TargetGroupArn: !Ref TargetGroup
Type: forward
我在基础设施中也有一个应用程序负载平衡器ALB。这是我的项目:以上ListenerRule匹配admin文件夹中的文件,例如:-index.html而不是路径/。因此,我添加了缺少的ListenerRule,如下所示
ListenerRule2:
Type: AWS::ElasticLoadBalancingV2::ListenerRule
Properties:
ListenerArn: !Ref Listener
Priority: 3
Conditions:
- Field: path-pattern
Values: [ "/admin" ]
Actions:
- TargetGroupArn: !Ref TargetGroup
Type: forward