Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
V

vouch-proxy

> DevOps
Open source

an SSO and OAuth / OIDC login solution for Nginx using the auth_request module

3.3K stars0 likes0 views
WebsiteGitHub

About

an SSO and OAuth / OIDC login solution for Nginx using the auth_request module

Vouch Proxy

An SSO solution for Nginx using the auth_request module. Vouch Proxy can protect all of your websites at once.

Vouch Proxy supports many OAuth and OIDC login providers and can enforce authentication to...

  • Google
  • GitHub
  • GitHub Enterprise
  • IndieAuth
  • Okta
  • Slack
  • ADFS
  • Azure AD
  • Alibaba / Aliyun iDaas
  • AWS Cognito
  • Twitch
  • Discord
  • SecureAuth
  • Gitea
  • Keycloak
  • OAuth2 Server Library for PHP
  • HomeAssistant
  • OpenStax
  • Ory Hydra
  • Nextcloud
  • Pocket ID
  • most other OpenID Connect (OIDC) providers

Please do let us know when you have deployed Vouch Proxy with your preffered IdP or library so we can update the list.

If Vouch is running on the same host as the Nginx reverse proxy the response time from the /validate endpoint to Nginx should be less than 1ms.


Table of Contents

  • What Vouch Proxy Does...
  • Installation and Configuration
    • Vouch Proxy "in a path"
    • Additional Nginx Configurations
    • Configuration via Environmental Variables
  • Tips, Tricks and Advanced Configurations
    • Scopes and Claims
  • Running from Docker
  • Kubernetes Nginx Ingress
  • Compiling from source and running the binary
  • /login and /logout endpoint redirection
  • Troubleshooting, Support and Feature Requests (Read this before submitting an issue at GitHub)
    • I'm getting an infinite redirect loop which returns me to my IdP (Google/Okta/GitHub/...)
    • Okay, I looked at the issues and have tried some things with my configs but it's still not working
    • Contributing to Vouch Proxy
  • Advanced Authorization Using OpenResty
  • The flow of login and authentication using Google Oauth

What Vouch Proxy Does

Vouch Proxy (VP) forces visitors to login and authenticate with an IdP (such as one of the services listed above) before allowing them access to a website.

VP can also be used as a Single Sign On (SSO) solution to protect all web applications in the same domain.

After a visitor logs in Vouch Proxy allows access to the protected websites for several hours. Every request is checked by VP to ensure that it is valid.

VP can send the visitor's email, name and other information which the IdP provides (including access tokens) to the web application as HTTP headers. VP can be used to replace application user management entirely.

Installation and Configuration

Vouch Proxy relies on the ability to share a cookie between the Vouch Proxy server and the application it's protecting. Typically this will be done by running Vouch on a subdomain such as vouch.yourdomain.com with apps running at app1.yourdomain.com and app2.yourdomain.com. The protected domain is .yourdomain.com and the Vouch Proxy cookie must be set in this domain by setting vouch.domains to include yourdomain.com or sometimes by setting vouch.cookie.domain to yourdomain.com.

  • cp ./config/config.yml_example_$OAUTH_PROVIDER ./config/config.yml
  • create OAuth credentials for Vouch Proxy at google or github, etc
    • be sure to direct the callback URL to the Vouch Proxy /auth endpoint
  • configure Nginx...

The following Nginx config assumes..

  • Nginx, vouch.yourdomain.com and protectedapp.yourdomain.com are running on the same server
  • both domains are served as https and have valid certs (if not, change to listen 80 and set vouch.cookie.secure to false)
…

If Vouch is configured behind the same nginx reverseproxy (perhaps so you can configure ssl) be sure to pass the Host header properly, otherwise the JWT cookie cannot be set into the domain

nginx
server {
    listen 443 ssl http2;
    server_name vouch.yourdomain.com;
    ssl_certificate /etc/letsencrypt/live/vouch.yourdomain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/vouch.yourdomain.com/privkey.pem;

    location / {
      proxy_pass http://127.0.0.1:9090;
      # be sure to pass the original host header
      proxy_set_header Host $http_host;
    }
}

Vouch Proxy "in a path"

As of v0.33.0 Vouch Proxy can be served within an Nginx location (path) by configuring vouch.document_root: /vp_in_a_path

This avoids the need to setup a separate domain for Vouch Proxy such as vouch.yourdomain.com. For example VP login will be served from https://protectedapp.yourdomain.com/vp_in_a_path/login

…

Additional Nginx Configurations

Additional Nginx configurations can be found in the examples directory.

Configuring via Environmental Variables

Here's a minimal setup using Google's OAuth...

bash
VOUCH_DOMAINS=yourdomain.com \
  OAUTH_PROVIDER=google \
  OAUTH_CLIENT_ID=1234 \
  OAUTH_CLIENT_SECRET=secretsecret \
  OAUTH_CALLBACK_URL=https://vouch.yourdomain.com/auth \
  ./vouch-proxy

Environmental variable names are documented in config/config.yml_example

All lists with multiple values must be comma separated: VOUCH_DOMAINS="yourdomain.com,yourotherdomain.com"

The variable VOUCH_CONFIG can be used to set an alternate location for the configuration file. VOUCH_ROOT can be used to set an alternate root directory for Vouch Proxy to look for support files.

Tips, Tricks and Advanced Configurations

All Vouch Proxy configuration items are documented in config/config.yml_example

  • Cacheing of the Vouch Proxy /validate response in Nginx
  • Handling OPTIONS requests when protecting an API with Vouch Proxy
  • Validation by GitHub Team or GitHub Org
  • Running VP on a Raspberry Pi using the ARM based Docker image
  • Kubernetes architecture post ingress
  • set HTTP_PROXY to relay Vouch Proxy IdP requests through an outbound proxy server
  • Reverse Proxy for Google Cloud Run Services
  • Enable native TLS in Vouch Proxy
  • FreeBSD support
  • systemd startup of Vouch Proxy
  • Using Node.js instead of Nginx to route requests
  • Developing a Single Page App (SPA) while consuming a VP protected API
  • Integrate Vouch Proxy into a server side application for User Authn and Authz
  • Filter by IP address before VP validation by using satisfy any;

Please do help us to expand this list.

Scopes and Claims

With Vouch Proxy you can request various scopes (standard and custom) to obtain more information about the user or gain access to the provider's APIs. Internally, Vouch Proxy launches a requests to user_info_url after successful authentication. The required claims are extracted from the provider's response and stored in the VP cookie.

⚠️ Additional claims and tokens will be added to the VP cookie and can make it large

The VP cookie may be split into several cookies to accomdate browser cookie size limits. But if you need it, you need it. Large cookies and headers require Nginx to be configured with larger buffers. See large_client_header_buffers and proxy_buffer_size for more information.

Setup scopes and claims in Vouch Proxy with Nginx

  1. Configure Vouch Proxy for Nginx and your IdP as normal (See: Installation and Configuration)

  2. Set the necessary scopes in the oauth section of the vouch-proxy config.yml (example config)

    1. set idtoken: X-Vouch-IdP-IdToken in the headers section of vouch-proxy's config.yml
    2. log in and call the /validate endpoint in a modern browser
    3. check the response header for a X-Vouch-IdP-IdToken header
    4. copy the value of the header into the debugger at https://jwt.io/ and ensure that the necessary claims are part of the jwt
    5. if they are not, you need to adjust the scopes in the oauth section of your config.yml or reconfigure your oauth provider
  3. Set the necessary claims in the header section of the vouch-proxy config.yml

    1. log in and call the /validate endpoint in a modern browser
    2. check the response headers for headers of the form X-Vouch-IdP-Claims-<ClaimName>
    3. If they are not there clear your cookies and cached browser data
    4. If they are still n

Issues· 65 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Goauthenticationgolangjwtlasso

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
CategoryDevOps
PricingOpen source

> Related tools

D
Docker
容器化平台,标准化应用交付
G
GitHub Actions
GitHub 原生 CI/CD 工作流
N
Nginx
高性能 Web 服务器与反向代理