Analytics cookies only (Google Analytics, PostHog). No ad networks, no cross-site tracking. See our privacy policy.
Self-host OAuth2 Proxy
updated Oct 2026deployed by usprices checked · Jul 2026Install verified on Ubuntu 26.04 · Oct 2026 · how we test
We earn commissions when you shop through the links below. Full disclosure →
A reverse proxy and middleware that puts OAuth2 and OIDC sign-in in front of applications that have no login of their own: a generic OIDC client plus provider implementations for Google, Microsoft Entra ID, GitHub, login.gov and others. Runs as a standalone proxy or as an `auth_request` target behind an existing proxy. MIT-licensed Go, stateless with cookie sessions.
Runs on a VPS from $4/mo (Kamatera 1GB, 1 GB RAM) · prices checked Sep 2026
Our recommendation
Pick OAuth2 Proxy when you already have an identity you trust (a GitHub organisation, Google Workspace, Entra ID, a Keycloak or other OIDC server) and just want to gate an app behind it. It holds no users and no passwords: it redirects to the provider, checks who comes back and sets a cookie, and your reverse proxy asks it on every request whether to let the visitor through. That is its difference from the catalog's Tinyauth and Authelia, which ship their own login portal and user store, and from Pocket ID or Keycloak, which are identity providers themselves. It is MIT-licensed Go and ships as a small container. Our snippet is a GitHub-provider example in Compose form with the cookie secret generated for you and the image pinned to a release tag. We did not find an upstream RAM minimum, so our 128 MB floor is an estimate.
What you need
Any VPS with at least 128 MB of RAM
A domain you control — most self-hosted setups need HTTPS in front of them
OAuth2 Proxy's configuration docs flag these before you protect anything with it:
non-negotiableThe snippet starts the proxy and answers /ping, but signing in needs a real OAuth app: create one with your provider, set its callback to http://SERVER_IP:4180/oauth2/callback (the redirect_url in the compose file) and put its client ID and secret in .env. The placeholders in .env are not credentials, so the sign-in redirect will fail until you replace them. Until you sign in, / answers with the Sign In page and an HTTP 403, which is how our check saw it; /ping is the health endpoint.
non-negotiableOAUTH2_PROXY_EMAIL_DOMAINS: "*" lets any account at the provider through, which is only there so the container starts. Restrict it before use, with allowed email domains or, for the GitHub provider, an organisation, team or user list. OAUTH2_PROXY_UPSTREAMS: static://202 makes the proxy answer 202 once a visitor is authenticated, the setup used when another proxy asks it to authorise requests; to proxy a real app, point UPSTREAMS at it instead.
non-negotiableThe cookie secret must be 16, 24 or 32 bytes, optionally base64-encoded; our snippet generates 32 random bytes into .env. COOKIE_SECURE: "false" is there only because the example is plain HTTP; leave it at its default (true) behind TLS, which is how it should run.
non-negotiableBehind another reverse proxy, the docs say to enable --reverse-proxy and set --trusted-proxy-ip to the proxies allowed to send X-Forwarded-* headers; leave it unset and every source IP is currently trusted for backwards compatibility. Never use --trusted-ip as a list of proxies: the docs call it an authentication bypass.