A strict domain-gated reverse relay for controlled outbound HTTP proxy routing.
GateRelay is a small Go HTTPS reverse relay for controlled access to fixed upstream services through a paid authenticated HTTP proxy. It accepts requests only for configured public hosts and configured path prefixes, then relays approved traffic to upstream targets defined in config.
GateRelay is intentionally not an open proxy.
GateRelay is built for deployments where users need access through a controlled public domain while outbound traffic must leave through a fixed authenticated HTTP proxy. The service keeps that setup narrow: every accepted host, path prefix, method, upstream, and proxy credential is configured by the operator.
- GateRelay receives an HTTP or HTTPS request.
/healthzis answered locally.- The request
Hostmust match a configuredpublic_host. - The request path must match a configured
allowed_path_prefix, such as/sub/. - The method must be listed in
allowed_methods. - The dynamic token after the allowed prefix must not be empty.
- Only after local validation passes, GateRelay builds the upstream URL from
upstream_baseand the incoming path. - The request is sent through the configured authenticated outbound HTTP proxy.
Unknown hosts, invalid paths, invalid methods, and empty tokens are rejected locally before the outbound proxy is touched.
- Upstream targets come only from configuration, never from user input.
- The paid outbound HTTP proxy is used only after strict local validation passes.
- Hop-by-hop headers are stripped from forwarded requests and returned responses.
Proxy-Authorizationis never forwarded to the upstream server or returned to clients.- Redirects from upstream are returned to the client instead of being followed automatically.
- Full subscription tokens are hidden from relay error logs when
security.hide_token_in_logsis enabled.
Example:
listen_address: ":443"
tls:
cert_file: "/etc/gaterelay/certs/fullchain.pem"
key_file: "/etc/gaterelay/certs/privkey.pem"
routes:
- public_host: "public.example.com"
upstream_base: "https://upstream.example.net"
allowed_path_prefix: "/sub/"
allowed_methods: ["GET"]
pass_query_string: true
outbound_http_proxy:
url: "http://proxy.example.net:8080"
username: "YOUR_PROXY_USERNAME"
password: "YOUR_PROXY_PASSWORD"
security:
reject_empty_host: true
hide_token_in_logs: true
max_request_body_bytes: 1048576See configs/production.example.yaml for a fuller production example.
Use the development sample without TLS:
go run ./cmd/gaterelay -config config.example.yamlValidate a config without serving:
go run ./cmd/gaterelay -config configs/production.example.yaml -check-configGateRelay can serve HTTPS directly with tls.cert_file and tls.key_file. It does not require Docker or external runtime services.
A common production flow is to build the binary elsewhere, copy it to the server, install a config file under /etc/gaterelay/config.yaml, validate it with -check-config, then start GateRelay under systemd. This makes offline deployment straightforward after the binary and config are prepared.
See docs/deploy-notes.md for compact install notes.
A service template is provided at deploy/gaterelay.service.
The unit runs:
/usr/local/bin/gaterelay -config /etc/gaterelay/config.yamlKeep proxy credentials in the config file, not in the systemd unit or command line.
go test ./...
go build -o gaterelay ./cmd/gaterelayThe project uses only the Go standard library.
GateRelay is licensed under the GNU Affero General Public License v3.0. See LICENSE.