Sitemap
AWS in Plain English

New AWS, Cloud, and DevOps content every day. Follow to join our 3.5M+ monthly readers.

How to implement HTTP basic auth on Cloudfront?

4 min readJun 7, 2023

--

Press enter or click to view image in full size
Photo by Robin Jonathan Deutsch on Unsplash

What is basic auth?

Basic access authentication is a method for an HTTP user agent (e.g. a web browser) to provide a user name and password when making a request. In basic HTTP authentication, a request contains a header field in the form of Authorization: Basic <credentials>, where credentials is the Base64 encoding of ID and password joined by a single colon :.

It was originally implemented by Ari Luotonen at CERN in 1993[1] and defined in the HTTP 1.0 specification in 1996.[2] It is specified in RFC 7617 from 2015, which obsoletes RFC 2617 from 1999.

source: wiki

Where can I use this?

This type of implementation on cloudfront is commonly employed in the following scenarios:

  1. Web applications intended for limited visibility during the development phase, targeting a specific group
  2. Web applications that should remain inaccessible to bots and are intended solely for internal use

How to implement it?

We will make use of Lambda’ edge “origin request” lifecycle function.

Which means, that just before the cloudfront passes on the request details to origin, it will run an authentication check via the…

--

--

Meta Collective
Meta Collective

Written by Meta Collective

A collection of articles on technology, focusing on systems engineering, Cloud Computing, SDLC processes, & more. https://medium.com/@metacollective/membership

AWS in Plain English
AWS in Plain English

Published in AWS in Plain English

New AWS, Cloud, and DevOps content every day. Follow to join our 3.5M+ monthly readers.