Proxy Endpoint (Origin Server)

PUT /v1/endpoints/{uuid}/proxy

Turns an endpoint's proxy on, changes its origin server, or turns it off. A proxy endpoint has no agent: ngris forwards its traffic straight to your own server.

Your server, the origin server, is a public IP address or hostname. The endpoint forwards one line per protocol, each optional, at least one: web traffic to origin_port (with the SSL check origin_tls), the endpoint's dedicated TCP port to origin_tcp_port, and its dedicated UDP port to origin_udp_port. To create a proxy endpoint in one call, send serving_mode: "proxy" to POST /v1/endpoints. The whole guide: Proxy endpoints.

On, change, off

  • Turn on: enabled: true on an agent endpoint. The endpoint must be free: no agent connected, no app attached, no routing rules, not a per-device endpoint, and room under your plan for another proxy endpoint.
  • Change: enabled: true on a proxy endpoint. A change replaces every origin field: send every field. A line you leave out is removed, and an SSL check you leave out goes back to encrypt.
  • Turn off: enabled: false. The endpoint is an agent endpoint again, and its server details are forgotten.

A TCP or UDP line forwards the endpoint's dedicated port of that protocol to that port of your server. Without a dedicated port of that protocol, the line isn't forwarded: give the endpoint one with POST /v1/endpoints/{uuid}/ports/{protocol}, and ngris picks a free port. Without a web line (origin_port), web visitors see the endpoint as offline, and its health checks are turned off: they need an HTTP line.

Your server receives each web request with the endpoint's hostname as its Host (over HTTPS, also as the TLS server name), and the visitor's address in X-Forwarded-For. TCP and UDP connections come from ngris.

Proxy endpoints are a plan feature (proxy_endpoints), and your plan sets how many you can have: GET /v1/account/entitlements shows yours. A quota-paused endpoint is read-only: every change is refused with 409 quota_paused.

Path parameters

uuid string (uuid) Req
The endpoint's uuid.

Request body

enabled boolean Req
true: forward to the server below (turn the proxy on, or change it). false: turn the proxy off; no other field is needed.
origin_host string
Your server's public IP address or hostname. Required with enabled: true.
origin_port int
Your server's port for web traffic, 1 to 65535. Left out: web visitors aren't forwarded.
origin_tls string
How ngris connects to your server's web port: encrypt (the default), strict or off (below). Only with origin_port.
origin_tcp_port int
Your server's port for the endpoint's dedicated TCP port, 1 to 65535. Left out: TCP isn't forwarded.
origin_udp_port int
Your server's port for the endpoint's dedicated UDP port, 1 to 65535. Left out: UDP isn't forwarded.

With enabled: true, give at least one of origin_port, origin_tcp_port and origin_udp_port. Unknown fields are refused.

The SSL check (origin_tls)

encrypt
The default; the dashboard's Encrypt only. HTTPS to your server, and its certificate isn't checked: a self-signed certificate works.
strict
The dashboard's Strict. HTTPS with a valid public certificate for the endpoint's own hostname: ngris connects with the endpoint's name (in Host and as the TLS server name), not your server's own name, so a certificate for your server's name alone doesn't pass.
off
The dashboard's Off. Plain HTTP.

Response (200 OK)

The endpoint's mode and server, after the change. Empty fields are left out: after enabled: false, only uuid and serving_mode: "agent".

uuid string (uuid)
The endpoint.
serving_mode string
proxy while the proxy is on, agent once it is off.
origin_host, origin_port, origin_tls, origin_tcp_port, origin_udp_port string?, int?, string?, int?, int?
The server details as saved. origin_tls comes with origin_port.

Errors

A refusal carries code, which says why, and error, the sentence to show: relay it as it is.

400
The body isn't JSON, has an unknown field, or has no enabled. Or a server detail is refused:
origin_port_invalid: “Enter at least one of your server's ports: web, TCP or UDP, from 1 to 65535.”, “Enter your server's web port, from 1 to 65535.” or “Enter your server's TCP and UDP ports from 1 to 65535, or leave them empty.”
origin_tls_invalid: “Choose how ngris connects to your server: encrypt, strict or off.” or “The SSL check is for your server's web port: give the web port too, or leave the SSL check out.”
origin_host_invalid: the address isn't written as an IP address or hostname; error says what to fix.
origin_not_allowed: “Use your server's public IP address or hostname…”: a private or reserved address, or one of ngris's own, is refused.
origin_invalid: “Check your server's address and ports.”
401
Missing auth.
403
entitlement_required (with "entitlement_required": "proxy_endpoints"): your plan has no proxy endpoints.
proxy_endpoints_limit: “Your plan allows N proxy endpoint(s). Turn one off or upgrade your plan.”
404
endpoint not found: no such endpoint in your active account (another account's reads the same).
409
endpoint_has_agent: “An agent is connected to this endpoint. Stop it before you turn on the proxy.”
endpoint_ephemeral: “This is a per-device endpoint. Reserve it first, then turn on the proxy.”
endpoint_serves_app: it serves an application. Detach it there first.
endpoint_has_routing_rules: it has routing rules. Remove them first.
endpoint_not_proxy: “This endpoint doesn't forward to a server.” (turning off an endpoint whose proxy isn't on).
quota_paused: the endpoint is paused over your plan's limits and is read-only.
503
origin_check_unavailable: “The origin server can't be checked right now. Try again in a minute.”
proxy_unavailable: proxy endpoints can't be used right now.
Request: turn on, or change (send every field)
curl -X PUT "https://api.ngris.com/v1/endpoints/019bb1e4-e785-77d2-9966-c3cff31d0a0e/proxy" \ -H "X-API-KEY: <your_api_key>" \ -H "Content-Type: application/json" \ -d '{ "enabled": true, "origin_host": "203.0.113.10", "origin_port": 443, "origin_tls": "encrypt", "origin_tcp_port": 5432 }'
CLI
ngris api endpoints set-proxy 019bb1e4-e785-77d2-9966-c3cff31d0a0e \ --enabled true --origin-host 203.0.113.10 --origin-port 443 \ --origin-tls encrypt --origin-tcp-port 5432
Response — 200 OK
{ "uuid": "019bb1e4-e785-77d2-9966-c3cff31d0a0e", "serving_mode": "proxy", "origin_host": "203.0.113.10", "origin_port": 443, "origin_tls": "encrypt", "origin_tcp_port": 5432 }
Request: turn off
curl -X PUT "https://api.ngris.com/v1/endpoints/019bb1e4-e785-77d2-9966-c3cff31d0a0e/proxy" \ -H "X-API-KEY: <your_api_key>" \ -H "Content-Type: application/json" \ -d '{ "enabled": false }'
Response — 409 Conflict
{ "error": "An agent is connected to this endpoint. Stop it before you turn on the proxy.", "code": "endpoint_has_agent", "reason": "agent_online" }
Was this helpful?