Membrane API Gateway returns 403 Forbidden with the title Access Denied when the accessControl plugin does not permit the client's address. This is the configured policy acting on the client, not a malfunction of the gateway.
The response contains the status 403 Forbidden, the title Access Denied, the problem type https://membrane-api.io/problems/security and a link to this page. The type security means that a security plugin refused access to the API.
The accessControl plugin evaluates an ordered list of allow and deny rules in the request flow. A rule contains an IPv4 or IPv6 address, optionally with a CIDR prefix, or a hostname pattern. The first rule that matches decides. If no rule matches, access is denied.
api:
port: 2000
flow:
- accessControl:
- allow: "10.0.0.0/8"
- deny: "0.0.0.0/0"
target:
url: https://api.predic8.de
api:
port: 2000
flow:
- accessControl:
- allow: "10.0.0.0/8"
- deny: "0.0.0.0/0"
target:
url: https://api.predic8.de
The first matching rule is a deny rule for the client's address or hostname. An allow rule further down the list is never reached.
When none of the rules matches the client's address, access is denied by default.
The plugin checks the TCP peer of the connection, not the X-Forwarded-For header. Behind a load balancer or reverse proxy, the rules see the proxy's address instead of the client's.
Hostname rules are matched against the reverse DNS name of the peer. If that name differs from the pattern, for example because reverse DNS is not set up, the rule does not match.
If the client address cannot be determined or parsed, the request is always denied.
allow rule for the address, CIDR range or hostname, and place it before any broader deny rule.Unlike most errors, this error is sent with the link to this page even when Membrane runs in production mode. Setting production: true in the configuration document does not remove it.
Configuration reference:
Tutorials with runnable examples:
Still stuck? See the troubleshooting guide or ask on GitHub Issues. For commercial support, contact info@predic8.de.