Apache Casbin Gateway
5. Operations

5.2 Security and serving other machines

Gateway binds 127.0.0.1 by default, because two things are wide open to whoever can reach the port:

  • the UI signs the local admin in without asking,
  • and /v1 relays with the API keys stored here.

Both are exactly what you want from a local tool, and neither should be offered to a network.

Serving other machines anyway

Set httpaddr = 0.0.0.0 in conf/app.conf, and then do both of these:

  1. Change the admin password from My Account. The automatic sign-in stops at the first request that is not from this machine, so from then on the password is the only thing in the way.
  2. Send the relay token with every request to /v1. Gateway generates one on first start and shows it under Settings → Security.

The environment snippets on the Providers and Agents pages already carry the token, and it is what Gateway writes into the configuration of an agent it switches. Requests from this machine never need it.

Keys at rest

apiKeyEncryptionKey, under Settings → Security, encrypts provider API keys in the database with AES-256-GCM. Set it before adding the providers whose keys you care about.

What never reaches storage in the first place:

  • Request headers, which is where an inbound API key would be — they are not recorded at all.
  • Anything credential-shaped in a recorded body, which is replaced before the record is written (4.2).

Network settings

Settings → Network:

FieldWhat it is for
Outbound SOCKS5 proxyReach vendor endpoints through a proxy
Allowed hostsWhich Host headers Gateway answers to
Allowed originsWhich browser origins may call the API

The last two matter once httpaddr is not loopback: a Gateway on a network should answer to the names you meant it to answer to.

Sign-in

Out of the box, sign-in is Gateway's own user table with the local admin auto-signed-in. Setting casdoorEndpoint switches the whole thing over to Casdoor, which brings SSO and OAuth logins with it (5.1).

What an agent gets, and what it does not

An agent routed through Gateway holds Gateway's relay token, never a vendor key. Revoking one agent's access is a Gateway-side change, not eight configuration file edits — and the Permissions page can narrow what that token is good for without touching the agent at all.

Next: 5.3 Backups and cloud sync.

Edit on GitHub
Apache Incubator

Apache Casbin (Incubating) is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.

Copyright © 2026 The Apache Software Foundation, Licensed under the Apache License, Version 2.0.

Apache, Apache Casbin, the names of Apache projects, and the feather logo are either registered trademarks or trademarks of The Apache Software Foundation in the United States and/or other countries. All other marks mentioned may be trademarks or registered trademarks of their respective owners.

On this page