Skip to content

ALB does not get requests when using CNAME record, instead it is treated as an S3 request. #1676

Open
@barrydunne

Description

@barrydunne

I have a working ALB that I can access using http://local-alb.elb.localhost.localstack.cloud:4566/
My goal is to have different host based rules on the listener to target different ECS services.

As a first step toward this goal I have created a hosted zone in R53 named aws-playground.local
Within that zone I have a CNAME record for test.aws-playground.local that points to local-alb.elb.localhost.localstack.cloud

Running dig on the LocalStack container shows it is available

dig @localhost test.aws-playground.local ANY

;; QUESTION SECTION:
;test.aws-playground.local.     IN      ANY

;; ANSWER SECTION:
test.aws-playground.local. 300  IN      CNAME   local-alb.elb.localhost.localstack.cloud.

On the LocalStack container I can run this command and get the expected response from the ALB

curl http://local-alb.elb.localhost.localstack.cloud:4566/test

I can also run this command and get the expected response from the ALB

curl -H "Host: local-alb.elb.localhost.localstack.cloud:4566" http://localhost:4566/test

But if I run this command I do not get a response from the ALB, instead I get a message saying "The specified bucket does not exist"

curl -H "Host: api.aws-playground.local:4566" http://localhost:4566/test

Outside of docker I have also added an entry in my local hosts file to point api.aws-playground.local to 127.0.0.1 and see the same behaviour.

Is it possible to use a custom domain to access an ALB in LocalStack?
I would be happy to disable the ability to access S3 buckets via domain if that was an option.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions