Gateway, login and private access
An application is reachable from outside because a link from the gateway to it exists. Rate limits, CORS, allow-lists, login and the web application firewall are attributes and links around that route — so they are reviewed, versioned and regenerated like the rest of the stack.
A route is a link
A link apisix-<type> from the APISIX component to a component generates its route:
| Generated | From |
|---|---|
A route on <subdomain>.<domain>, plus any additional_domain lines | The link's subdomain and the stack's domain |
| An upstream to the component's in-cluster Service | The component's name and namespace |
| TLS with the stack's wildcard certificate | cert-manager |
| The plugins below, each only when its attribute is set | The link's attributes |
An application without a gateway link has no route and is reachable only inside the cluster. Machine-facing routes — the AI gateway, vLLM, KServe, the Kafka bridge, Loki, the Prometheus ingress, the stack agent and the MCP server — carry key authentication from their own link attributes.
The options on an application route
These are the attributes of the apisix-external_source_code link. Other route types carry the
subset their template reads.
| Attribute | Renders | Know this |
|---|---|---|
rate_limiting + rate_limit_count | limit-count: that many requests per 60 seconds per client address | Counted on each gateway replica. A page or client that makes many calls from one address hits it first: raise the count rather than turning the limit off |
cors + cors_headers | cors, configured by the lines you give | Empty lines mean every origin. A wildcard is written allow_origins: "*" with the quotes, and never together with allow_credential: true |
whitelist + ip_whitelist | ip-restriction | 0.0.0.0/0 allows everyone even with the switch on |
apisix_oidc_enable (+ apisix_oidc_param) | openid-connect | See Login from a link |
max_body_size | client-control with the maximum request body | — |
response_headers, remove_response_headers | response-rewrite: headers set or removed on the way out | One header name per line for removal. Removing a header the cors plugin sets removes it from CORS answers too |
proxy_rewrite + headers | proxy-rewrite on the way in | — |
allowed_methods, websocket, apisix_timeout | The methods the route accepts, WebSocket upgrade, upstream timeouts | — |
The order a request meets
APISIX runs global rules before any route plugin, then the route's plugins by priority, highest first. That fixes the order on an application route:
| Order | Step | Priority |
|---|---|---|
| 1 | The VPN guard, when the gateway is VPN-only | Global rule |
| 2 | CORS | 4000 |
| 3 | IP allow-list | 3000 |
| 4 | Web application firewall | 2650 |
| 5 | Login | 2599 |
| 6 | Rate limit | 1002 |
| 7 | The application | — |
Login from a link
An application gets a login at the gateway from one link, the way every other integration works.
Draw external_source_code-client to a client sub-component, or
client-external_source_code from it. The application receives
OIDC_ISSUER_URL, OIDC_DISCOVERY_URL, OIDC_REALM,
OIDC_CLIENT_ID, OIDC_CLIENT_SECRET and OIDC_REDIRECT_URIS.
The apisix-keycloak_operator link gives Keycloak its public host, which becomes the
discovery address.
Set apisix_oidc_enable on the application's route link. The route's
openid-connect plugin is built from the client's id and secret, the Keycloak host, the
stack's domain and the client's realm.
The rules, as the template applies them:
- The realm is the client's. A client linked
client-realmto a realm sub-component lives in that realm, and the login uses it; otherwise the main realm. - Hand-written parameters still win. A real
apisix_oidc_paramblock is rendered as it is. The catalog's example block, the one namingkeycloak.domain, counts as unset. - Login on, but no client link and no parameters: nothing is rendered and the route stays open.
- An application that runs its own login flow keeps
apisix_oidc_enableoff. It still gets the client in its environment.
Who may then use the application is decided by Keycloak groups, not by the route — see Identity and secrets.
Web application firewall
The firewall is CrowdSec's AppSec engine — Coraza with the OWASP Core Rule Set — run as part of the CrowdSec component.
| On the graph | What it does |
|---|---|
A waf sub-component on the CrowdSec component | One profile. Profile i, in name order, listens on port 7422+i behind the Service <crowdsec>-waf |
waf-external_source_code or waf-image_base from the profile to an application | That application's route gets the crowdsec-appsec plugin, which sends every request to the profile first and enforces the verdict |
apisix-crowdsec | Required: it registers the gateway as a bouncer, with a key both templates derive from the same attribute, so no key is exchanged by hand |
waf_failure_action on the link | passthrough: an unreachable profile lets requests through. deny: it refuses them |
The profile's attributes:
| Attribute | Meaning |
|---|---|
waf_mode | detect: every rule runs out of band, a match raises an alert, nothing is blocked. block: rules run in band and a match is refused with waf_blocked_http_code |
waf_collections, waf_rulesets | Which CrowdSec hub collections are installed and which rule sets run next to the Core Rule Set — for example the virtual patches, one per known CVE |
waf_exclusions | One per line: a rule id, a rule id with a condition on the request, or a rule name. Dropped for this profile only |
waf_body_inspection, waf_body_limit | Whether request bodies are inspected, and how much of them |
Start in detect, read the alerts (in the SIEM with a crowdsec-opensearch link, on its dashboard
CrowdSec - Web Application Firewall), add exclusions, then switch to block. Address-level bans are
the firewall bouncer's job — see Detection and response.
Private access with the VPN
The vpn component runs a WireGuard server managed by wg-portal. People sign in with the stack's
single sign-on, get a peer, and load it into any WireGuard client.
| On the graph | What it does |
|---|---|
vpn component | The WireGuard server, its portal and a bootstrap Job |
A Keycloak client for the portal, vpn-client | Single sign-on into the portal |
apisix-vpn | The portal's own route, always public |
vpn-apisix | The guard: every HTTP route of the gateway answers 403 outside the tunnel |
What stays public with the guard on: the identity provider, the VPN portal, the MCP server, and the
hosts listed in the link's public_hosts (one per line, *.example.com covers every host under it).
The stack agent is VPN-only unless its host is listed. public_paths opens URI prefixes on every
host; internal_cidrs lets callers from those addresses through without the tunnel.
Things to know before turning it on:
| In-cluster callers of public names | The DAST scanner and Nextcloud's document editing reach VPN-only hosts through their public names from inside the cluster. Put the cluster's pod ranges in internal_cidrs, or the scan sees 403 and reports a clean result |
internal_cidrs needs real source addresses | Turn on the gateway component's external_traffic; otherwise the gateway sees node addresses and the list matches nothing. The build warns |
| APIs called from the internet | List their hosts in public_hosts: an external caller has no pod address |
| Peers route one address | A peer's configuration routes only the gateway's public address and carries no DNS line, so tunnels of several stacks can be up together. Give each stack its own tunnel_cidr |
| Deactivate before deleting | Deleting a peer while its tunnel is up cuts that device off the stack until a new peer exists |
Without the vpn-apisix link, nothing in the stack changes.
The AI gateway
An AI gateway sub-component on the APISIX component is a route to one served model, with key auth,
a prompt guard, a system prompt, a token budget and an optional fallback, all from attributes. An
application reaches it through <app>-ai_gateway and never sees the model server directly — see
Private AI.