selfhost.directory

The index of self-hostable projects — ranked, categorized and served with live updates.
Own your data and stop giving it to big tech.

GitHub
nforwardauth logo

Self-host nforwardauth

v1.5.1

Lightweight forward auth service for reverse proxies

ReleaseOpen SourceMIT
Updated9 hours ago
LanguageRust
Setup difficultyModerate
Stars
159
Port
3000 (HTTP forward auth service)
Docker
nosduco/nforwardauth
Install with Docker
nforwardauth login page screenshot

What is nforwardauth?

nforwardauth is a minimalist forward authentication service written in Rust that sits between a reverse proxy and protected applications. It authenticates users via a passwd file with SHA-512 hashed credentials and issues signed tokens stored in cookies. Once authenticated, users can access all protected services without re-entering credentials. It supports Traefik, Caddy, and nginx as reverse proxies, includes a built-in rate limiter for login attempts, and can pass the authenticated username to downstream services via the X-Forwarded-User header. The service is configured entirely through environment variables and requires only a passwd file volume mount. It has no external database dependencies.

Should you self-host nforwardauth?

nforwardauth scores 44/100 on selfhost.directory (how scoring works) and ranks #28 of 40 in Authentication. It has 159 GitHub stars.

It shipped 1 stable release in the past year. The latest, v1.5.1, came out on 10 July 2026.

Setup is moderate: expect some configuration beyond a single command. An official Docker image is available. It is MIT-licensed and written mostly in Rust.

Its closest alternative on selfhost.directory is keycloak (86/100, 37 571 stars). It scores higher overall, so compare the two before you pick. See nforwardauth vs keycloak side by side.

Features

  • Basic auth compatibility
  • Cookie-based session
  • Forward authentication
  • Multi-proxy support
  • Rate Limiting
  • Single sign-on across services
  • Username/password authentication
  • X-Forwarded-User header

nforwardauth README

How to install nforwardauth

Install nforwardauth with Docker

Environment variables
AUTH_HOST, TOKEN_SECRET, COOKIE_SECURE, COOKIE_DOMAIN, COOKIE_NAME, PORT, PASS_USER_HEADER, RATE_LIMITER_ENABLED, RATE_LIMITER_MAX_RETRIES, RATE_LIMITER_FIND_TIME, RATE_LIMITER_BAN_TIME

docker run -p 3000:3000
-e TOKEN_SECRET=example-secret-123
-e AUTH_HOST=nforwardauth.localhost.com
-v /path/to/passwd:/passwd
nosduco/nforwardauth:v1

Requires a passwd file mounted at /passwd

How to configure nforwardauth

  • AUTH_HOSTURL where nforwardauth is accessible (required)

    URL where nforwardauth is accessible (required)

  • COOKIE_DOMAINInferred by base url of AUTH_HOSTSet the domain for the cookies, allow auth on sites beyond the root domain

    Set the domain for the cookies, allow auth on sites beyond the root domain

  • COOKIE_NAMEnforwardauthSet name for the cookies. Helpful if running multiple instances to prevent collision

    Set name for the cookies. Helpful if running multiple instances to prevent collision

  • COOKIE_SECUREtrueWhether or not to set cookies with secure flag

    Whether or not to set cookies with secure flag

    values: true, false

  • PASS_USER_HEADERtrueEnable or disable passing of authenticated user in header X-Forwarded-User for downstream identification

    Enable or disable passing of authenticated user in header X-Forwarded-User for downstream identification

    values: true, false

  • PORT3000Set port to listen on

    Set port to listen on

  • RATE_LIMITER_BAN_TIME300Time in seconds to ban clients after reaching RATE_LIMITER_MAX_RETRIES

    Time in seconds to ban clients after reaching RATE_LIMITER_MAX_RETRIES

  • RATE_LIMITER_ENABLEDtrueEnable or disable the built-in rate limiter

    Enable or disable the built-in rate limiter

    values: true, false

  • RATE_LIMITER_FIND_TIME120Time in seconds to keep track of login attempts

    Time in seconds to keep track of login attempts

  • RATE_LIMITER_MAX_RETRIES3Max retries allowed within RATE_LIMITER_FIND_TIME

    Max retries allowed within RATE_LIMITER_FIND_TIME

  • TOKEN_SECRETSecret to use when signing the auth token (required)

    Secret to use when signing the auth token (required)

nforwardauth releases & version history

More in Authentication

Rate this project

Click to rate — no account needed.

0 comments

Posting as guest
Loading comments…