Access Control
Configure access control for GoDoxy
GoDoxy implements access control at two distinct network layers, each operating at different points in the request lifecycle:
| Layer | Description | Blocking Behavior |
|---|---|---|
| Layer 4 (TCP/UDP) | IP filtering when connection is established | Connection dropped immediately |
| Layer 7 (HTTP) | IP filtering when HTTP request is fully received | HTTP error response returned |
Layer 4
Transport-layer filtering before HTTP data exchange. Blocked IPs see immediate connection drop with no response.
| Use Case |
|---|
| Blocking scanners early |
Supported Filters
| Type | Example | MaxMind Credentials Required |
|---|---|---|
| IP address | ip:1.2.3.4 | No |
| CIDR | cidr:1.2.3.4/32 | No |
| Named address set | set:family | No |
| Hostname | host:home.dyndns.example | No |
| ISO country code | country:US | Yes |
| Timezone | tz:Asia/Shanghai | Yes |
Hostname address sources
host:<name> matches the hostname's current A and AAAA addresses through the
system resolver, including /etc/hosts. Names are shared across ACLs,
cidr_whitelist allow, real_ip from, rules and bypass remote, and access
log filters.cidr.values. They refresh every minute without a config reload.
Proxy Protocol trusted_proxies supports only static IPs and CIDRs.
New names resolve in the background and match nothing until the first success.
In an allow list this grants no access; in a deny list it blocks nothing. A
real_ip proxy is not trusted until its name resolves. After a successful lookup,
failed refreshes, including NXDOMAIN, retain the last known addresses indefinitely.
After an address change, an allow list can keep allowing the old address while
not allowing the new one; a deny list can keep denying the old address while not
denying the new one, until a successful refresh observes the change.
Use names and resolvers you trust. A terminal DNS dot is preserved:
host:home.example. is absolute, while host:home.example may use resolver search
domains, so they are distinct sources. Bare IPs match exactly, including IPv6
(/32 for IPv4, /128 for IPv6).
Named sets reuse the root address_sets definitions.
Undefined names reject configuration acceptance.
ACL Configuration
| Key | Type | Description | Default |
|---|---|---|---|
default | allow or deny | Default action | allow |
allow_local | bool | Allow local addresses | true |
allow | Filter List | Allow list | [] |
deny | Filter List | Deny list | [] |
log | object | Log configuration with extra log_allowed field | {} |
notify | object | Periodically send access summary to notification provider | {} |
ACL Notification Configuration
| Key | Type | Description | Required | Default |
|---|---|---|---|---|
to | string list | List of notification provider names | No | [] |
interval | duration | Interval between notifications | No | 1m |
include_allowed | bool | Include allowed connections in notification | No | false |
ACL Example
# config.yml
acl:
default: allow # or deny (default: allow)
allow_local: true # or false (default: true)
allow:
- ip:1.2.3.4
- cidr:1.2.3.4/32
- host:home.dyndns.example
- country:US
- tz:Asia/Shanghai
deny:
- ip:1.2.3.4
- cidr:1.2.3.4/32
- country:US
- tz:Asia/Shanghai
log:
path: /app/logs/acl.log # (default: none)
stdout: false # (default: false)
keep: last 10 # (default: none)
log_allowed: true # (default: false)
notify:
to: [discord]
interval: 1h
include_allowed: true
providers:
maxmind:
account_id: 123456
license_key: your-license-key
database: geolite # or geoip2 if you have subscription
notification:
- name: discord
provider: discord
url: https://discord.com/api/webhooks/1234567890/abcdefghijklmnopqrstuvwxyz
token: your-tokenLayer 7
HTTP-level filtering after request headers/body received. Blocked IPs see HTTP 403 error response.
| Use Case |
|---|
| Traffic that requires feedback |
HTTP Access loggers can be configured - in config.yml under entrypoint
section - per route in docker labels or route files
Request Whitelist Configuration
| Key | Type | Description | Required | Default |
|---|---|---|---|---|
allow | Address source list | Allow list (IP, CIDR, host:<name>, or set:<name>) | No | [] |
status_code | int | Status code | No | 403 |
message | string | Error message | No | IP not allowed |
Request Whitelist Example
# config.yml
entrypoint:
middlewares: # allow only local (private) ips
- use: CIDRWhiteList
allow:
- 127.0.0.1/32
- 172.16.0.0/12
- 192.168.0.0/16
- 10.0.0.0/8
status_code: 403
message: Forbidden
access_log:
format: json
path: /app/logs/access.json.log
filters: # skip logging requests from local (private) ips
cidr:
negative: true
values:
- 127.0.0.1/32
- 172.16.0.0/12
- 192.168.0.0/16
- 10.0.0.0/8
fields:
headers:
default: drop # drop app headers in log
config: # keep only these
X-Real-Ip: keep
CF-Connecting-Ip: keep
X-Forwarded-For: keep
# docker labels
proxy.#1.middlewares.cidr_whitelist: |
allow:
- 10.0.0.0/8
- 192.168.0.0/16
status_code: 403
message: "IP not allowed"Explain an Access Decision
Use GET /api/v1/route/explain to preview the peer-IP ACL, route lookup and
supported request middleware without contacting an upstream, calling an auth
server, consuming rate limits, or writing access logs, blocked events or
notifications. On the authenticated API, use a browser-session cookie. The
read-only machine token cannot call this endpoint.
For a local loopback API listener at 127.0.0.1:8889, a tunnel visitor can be
checked with:
curl --get 'http://127.0.0.1:8889/api/v1/route/explain' \
--data-urlencode 'ip=127.0.0.1' \
--data-urlencode 'host=app.example.com' \
--data-urlencode 'header=CF-Connecting-IP: 198.51.100.10'ip is the connection's peer IP before real-IP middleware. host is the
request authority, including the listener port when nondefault, such as
app.example.com:8443. Optional path, method and scheme default to /,
GET and https. Repeat header=Name: value for multiple headers. Listener
selection respects the scheme and port, without falling back to another
listener that happens to contain the route. An exact authority bind is preferred;
a literal IP authority cannot use a listener bound to another IP. Hostname
authorities or binds alone do not establish the connection destination, so
selection assumes the configured default or a wildcard bind when no exact bind
exists and reports that assumption in notes. No DNS lookup is performed.
Account for any external port translation when describing the GoDoxy listener.
Probes start with a normal origin-form request URL. Variables such as $req_url
contain the path and query, with the authority in Host and HTTPS represented
by TLS state.
The response includes route, acl, client_ip, middleware steps,
decided_by, detail and applicable notes. Optional fields are omitted
when unavailable.
| Decision | Meaning |
|---|---|
allowed | The evaluated request phases passed. Route rules and backend behavior can still change the outcome. |
denied | The ACL or an evaluated middleware denied the request. |
responded | An evaluated middleware answered directly, such as an HTTP-to-HTTPS redirect. |
conditional | Unmodeled behavior prevents a definitive answer. |
not_found | No listener or route matched; short links and not-found rules are not simulated. |
Auth, CrowdSec, captcha and rate limiting are listed as not_evaluated after
request bypass checks. Evaluation stops at unknown request behavior, because
it could change later bypass rules or access decisions. Response-only modifiers
are reported but not run, including their response-dependent bypass rules.
Load-balancer backend selection and TLS client-certificate verification also
produce conditional results; HTTPS assumes SNI equals Host. Cloudflare real-IP
resolution uses cached or bundled CIDRs without refreshing them.
Route rules are not simulated and may modify the request before route middleware
or produce another response. Check notes even when a middleware denied the
probe. Malformed inputs return HTTP 400, internal failures HTTP 500, and valid
probes HTTP 200 regardless of their decision. Missing browser authentication
returns 401; a read-only bearer token returns 403.
Access Logging
Common Fields
| Key | Type | Description | Allowed Values | Default |
|---|---|---|---|---|
path | string | Path to the access log file | /var/log/access.log | required |
stdout | bool | Enable stdout logging (can be used with path) | true or false | false |
keep or retention | See below | Retention policy | 30 days | |
rotate_interval | duration | Log rotation interval | Duration | 1h |
Log rotation
To enable log rotation, you may set keep or retention to a retention policy.
Default: 30 days
Format:
{N} days|weeks|months(e.g.30 days){N} KB|MB|GB|kb|mb|gb(e.g.100 MBfor 100 Megabytes,100 mbfor 100 Megabits)last {N}(e.g.last 10for last 10 lines)
HTTP Access Log
| Field | Type | Description | Allowed values | Default |
|---|---|---|---|---|
format | string | access log format | common, combined, json | combined |
filters | object | access log filters (optional) | ||
filters.*.negative | bool | negative filters | true or false | false |
filters.status_codes.values | integer or integer range | status code filters | ||
filters.method.values | string | method filters | GET, POST, ... | |
filters.host.values | string | host filters | hostname | |
filters.headers.values | string | headers filters | case-sensitive key or key=value | |
filters.cidr.values | string | IP/CIDR/hostname filters | see below | |
fields | object | access log fields | see below | |
fields.*.default | string (field mode) | default field behavior | keep, drop, redact | See below |
fields.*.config | key:value mapping (key is case-sensitive) | headers fields | key: field_mode | |
fields.headers.config.* | string | headers fields | header: field_mode | |
fields.query.config.* | string | query fields | query: field_mode | |
fields.cookies.config.* | string | cookies fields | cookie: field_mode |
format affects file logging only.Field Behavior
| Setting | Behavior |
|---|---|
keep | Field is logged as-is |
drop | Field is excluded from logs |
redact | Field value replaced with REDACTED |
- Multiple access loggers can share the same log file
- Negative filters (
filters.*.negative: true) exclude matching requests from logging - Query redaction format:
?key=REDACTED - Redaction for non-query fields requires
format: json - Default field config:
query.default:keepcookies.default:dropheaders.default:drop
ACL Log
| Field | Type | Description | Required | Allowed values | Default |
|---|---|---|---|---|---|
log_allowed | bool | log when IP is allowed | bool | true or false | false |
Full Example
# config.yml
entrypoint:
access_log:
format: json
path: /var/log/example.log
filters:
status_codes:
values:
- 200-299
- 101
method:
values:
- GET
host:
values:
- example.y.z
headers:
negative: true
values:
- foo=bar # when key "foo" is present and value is `bar`
- baz # when key "baz" is present
cidr:
values:
- 192.168.10.0/24
fields:
headers:
default: keep
config:
foo: redact
query:
default: drop
config:
foo: keep
cookies:
default: redact
config:
foo: keep
# route file
# same as above, but under your app config, e.g.
app1:
access_log:
format: json
...
# docker labels - string as inline mapping
proxy.app1.access_log: |
format: json
...
# docker labels - full label
proxy.app1.access_log.format: json
proxy.app1.access_log.filters.status_codes.values: 200-299,300
proxy.app1.access_log.fields.headers.config.foo: redact