@@ -3,9 +3,24 @@ id: behaviour
33title: Behaviour
44---
55
6−1. Any request passing through the proxy (and not matched by `--skip-auth-regex`) is checked for the proxy's session cookie (`--cookie-name`) (or, if allowed, a JWT token - see `--skip-jwt-bearer-tokens`).
7−2. If authentication is required but missing then the user is asked to log in and redirected to the authentication provider (unless it is an Ajax request, i.e. one with `Accept: application/json`, in which case 401 Unauthorized is returned)
8−3. After returning from the authentication provider, the oauth tokens are stored in the configured session store (cookie, redis, ...) and a cookie is set
9−4. The request is forwarded to the upstream server with added user info and authentication headers (depending on the configuration)
6+1. Authentication Requirement: All requests passing through the proxy to upstream applications require authentication, excluding default proxy endpoints.
7+ - Exception: If the request matches a skipped route (configured via `--skip-auth-route`):
8+ - Authentication is not enforced, but the proxy will opportunistically attempt to validate a session cookie (`--cookie-name`) or JWT (`--skip-jwt-bearer-tokens`) if present in the request.
9+ - Configured user info and authentication headers (e.g., `--pass-access-token`) are injected to upstream routes when validation succeeds.
1010
11−Notice that the proxy also provides a number of useful [endpoints](features/endpoints.md).
11+2. Unauthenticated Requests: When authentication is missing but required, the user is redirected to the configured Identity Provider (IdP) login page by default.
12+ - Ajax Requests: If the request has `Accept: application/json` header:
13+ - Returns `401 Unauthorized`.
14+ - Invalid JWT Tokens: If `--skip-jwt-bearer-tokens` is set and the request includes an invalid JWT:
15+ - Redirects to the login page by default.
16+ - Returns `403 Forbidden` if `--bearer-token-login-fallback` is set to `false`.
17+
18+3. Post-Authentication: After successful authentication with the IdP, OAuth tokens are stored in the configured session store (cookie or Redis), and a cookie is set.
19+
20+4. Request Forwarding: The authenticated request is processed based on configuration:
21+ - Forwarded to the configured upstream application with added user info and authentication headers, or
22+ - Returns a valid status code for downstream processing by another proxy or load balancer (e.g., Nginx or Traefik).
23+
24+---
25+
26+Note: The proxy also provides a number of useful [endpoints](features/endpoints.md) for monitoring and management.