amazon alb and basic auth


I have a simple site in fargate and an alb. I want to throw a simple basic auth on top of it – just a single hardwired username and password. Is there an easy way to do this?

I tried going to cognito – creating a user pool, and attaching it to the site, but there were questions like “callback url” – which i just set to the same url and “signout url” that I wasn’t sure about and when I managed to click a set of things that allowed me to add it, and add a listener to my https endpoint – it just gives a “redirect_mismatch” when I try to get in.

Is there any way to do what I want without editing the underlying system in any way?


I did the following tests using ALB and CloudFront (just to be able to test HTTPS)

  1. Encode credentials user=user and password=password
  2. Create ALB with the listener rule Authorization is Basic dXNlcjpwYXNzd29yZA==
    AWS ALB Listener rules
  1. Place ALB behind CloudFront and forward Authorization header
  2. Test result using curl
  3. Not clear how to make it to work in Browsers – inline password doesn’t work

Leave a Reply