GoDoxy
Advanced Topics

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:

LayerDescriptionBlocking Behavior
Layer 4 (TCP/UDP)IP filtering when connection is establishedConnection dropped immediately
Layer 7 (HTTP)IP filtering when HTTP request is fully receivedHTTP 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

TypeExampleMaxMind Credentials Required
IP addressip:1.2.3.4No
CIDRcidr:1.2.3.4/32No
Named address setset:familyNo
Hostnamehost:home.dyndns.exampleNo
ISO country codecountry:USYes
Timezonetz:Asia/ShanghaiYes

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

KeyTypeDescriptionDefault
defaultallow or denyDefault actionallow
allow_localboolAllow local addressestrue
allowFilter ListAllow list[]
denyFilter ListDeny list[]
logobjectLog configuration with extra log_allowed field{}
notifyobjectPeriodically send access summary to notification provider{}

ACL Notification Configuration

KeyTypeDescriptionRequiredDefault
tostring listList of notification provider namesNo[]
intervaldurationInterval between notificationsNo1m
include_allowedboolInclude allowed connections in notificationNofalse

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-token

Layer 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

KeyTypeDescriptionRequiredDefault
allowAddress source listAllow list (IP, CIDR, host:<name>, or set:<name>)No[]
status_codeintStatus codeNo403
messagestringError messageNoIP 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.

DecisionMeaning
allowedThe evaluated request phases passed. Route rules and backend behavior can still change the outcome.
deniedThe ACL or an evaluated middleware denied the request.
respondedAn evaluated middleware answered directly, such as an HTTP-to-HTTPS redirect.
conditionalUnmodeled behavior prevents a definitive answer.
not_foundNo 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

KeyTypeDescriptionAllowed ValuesDefault
pathstringPath to the access log file/var/log/access.logrequired
stdoutboolEnable stdout logging (can be used with path)true or falsefalse
keep or retentionSee belowRetention policy30 days
rotate_intervaldurationLog rotation intervalDuration1h

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 MB for 100 Megabytes, 100 mb for 100 Megabits)
  • last {N} (e.g. last 10 for last 10 lines)

HTTP Access Log

FieldTypeDescriptionAllowed valuesDefault
formatstringaccess log formatcommon, combined, jsoncombined
filtersobjectaccess log filters (optional)
filters.*.negativeboolnegative filterstrue or falsefalse
filters.status_codes.valuesinteger or integer rangestatus code filters
filters.method.valuesstringmethod filtersGET, POST, ...
filters.host.valuesstringhost filtershostname
filters.headers.valuesstringheaders filterscase-sensitive key or key=value
filters.cidr.valuesstringIP/CIDR/hostname filterssee below
fieldsobjectaccess log fieldssee below
fields.*.defaultstring (field mode)default field behaviorkeep, drop, redactSee below
fields.*.configkey:value mapping (key is case-sensitive)headers fieldskey: field_mode
fields.headers.config.*stringheaders fieldsheader: field_mode
fields.query.config.*stringquery fieldsquery: field_mode
fields.cookies.config.*stringcookies fieldscookie: field_mode
format affects file logging only.

Field Behavior

SettingBehavior
keepField is logged as-is
dropField is excluded from logs
redactField 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: keep
    • cookies.default: drop
    • headers.default: drop

ACL Log

FieldTypeDescriptionRequiredAllowed valuesDefault
log_allowedboollog when IP is allowedbooltrue or falsefalse

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

On this page