---
title: Apply HTTP basic auth to private endpoints
summary: Store username/password list in a dictionary, authorize user at the edge, reject requests that don't have correct credentials.
url: https://www.fastly.com/documentation/solutions/examples/http-basic-auth
---

Store username/password list in a dictionary, authorize user at the edge, reject requests that don't have correct credentials.

## VCL

[Try it in Fastly Fiddle](https://fiddle.fastly.dev/8c961147)

## Compute

### Rust

[Try it in Fastly Fiddle](https://fiddle.fastly.dev/f21d370a)

### Javascript

[Try it in Fastly Fiddle](https://fiddle.fastly.dev/56b88225)

### Go

[Try it in Fastly Fiddle](https://fiddle.fastly.dev/18a841ae)

