Sign inSign up

ogulcanaydogan/oauth2-proxy

By ogulcanaydogan

Updated 7 months ago

OAuth2/OIDC authentication reverse proxy (Google, GitHub, GitLab)

Image
0

1.2K

ogulcanaydogan/oauth2-proxy repository overview

OAuth2 Proxy

OAuth2/OIDC authentication reverse proxy. Protect any web application with Google, GitHub, GitLab, or any OIDC provider.

Quick Start

docker run -p 4180:4180 \
  -e OAUTH2_PROVIDER=google \
  -e OAUTH2_CLIENT_ID=xxx \
  -e OAUTH2_CLIENT_SECRET=xxx \
  -e OAUTH2_UPSTREAM=http://app:8080 \
  -e OAUTH2_EMAIL_DOMAIN=example.com \
  ogulcanaydogan/oauth2-proxy

Features

  • Multiple providers: Google, GitHub, GitLab, OIDC, Azure, Keycloak
  • Cookie-based sessions
  • Passes auth headers to upstream (X-Auth-Request-User, X-Auth-Request-Email)
  • Access token forwarding
  • Skip auth for specific routes (health checks, public APIs)
  • Auto-generated cookie secret if not provided

Environment Variables

VariableDescriptionDefault
OAUTH2_PROVIDERAuth provider (google/github/gitlab/oidc)google
OAUTH2_CLIENT_IDOAuth2 client ID (required)-
OAUTH2_CLIENT_SECRETOAuth2 client secret (required)-
OAUTH2_COOKIE_SECRETCookie encryption secret (auto-generated if empty)-
OAUTH2_UPSTREAMUpstream URL to proxy tohttp://localhost:8080
OAUTH2_LISTENListen address0.0.0.0:4180
OAUTH2_EMAIL_DOMAINAllowed email domain(s)*
OAUTH2_REDIRECT_URLOAuth2 redirect URL-
OAUTH2_OIDC_ISSUEROIDC issuer URL (for oidc provider)-
OAUTH2_SKIP_AUTH_ROUTESComma-separated routes to skip auth-
OAUTH2_COOKIE_SECURESecure cookie flagtrue

Docker Compose Example

services:
  app:
    image: nginx

  auth:
    image: ogulcanaydogan/oauth2-proxy
    ports:
      - "4180:4180"
    environment:
      - OAUTH2_PROVIDER=github
      - OAUTH2_CLIENT_ID=${GITHUB_CLIENT_ID}
      - OAUTH2_CLIENT_SECRET=${GITHUB_CLIENT_SECRET}
      - OAUTH2_UPSTREAM=http://app:80
      - OAUTH2_EMAIL_DOMAIN=*

License

MIT

Tag summary

Content type

Image

Digest

sha256:101304e50

Size

20 MB

Last updated

7 months ago

docker pull ogulcanaydogan/oauth2-proxy