set_site_nginx_snippet
Set custom nginx config on the BorealHost host proxy — WebSocket, timeouts, headers.
Use this when configuring your container's own nginx is not enough because
something in front of it is interfering. The host proxy sits between the
internet and your container, and by default its catch-all location / does
not do anything special per-site.
WEBSOCKETS: if your WebSocket endpoint returns 400 through your domain but upgrades correctly (101) when tested inside your container, the Upgrade header is being dropped in front of you. Add a location block that relays it:
location ^~ /your/ws/path/ {
proxy_pass <your site's existing upstream>;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 3600;
proxy_send_timeout 3600;
error_page 502 503 504 =502;
}When testing with curl, force HTTP/1.1 (curl --http1.1). A WebSocket handshake uses the Upgrade header, which is invalid in HTTP/2 — curl negotiates h2 with a CDN by default and the edge answers 400, which looks exactly like the bug you are trying to fix.
This config lives OUTSIDE the generated vhost, so it survives domain re-linking, autoconfig, plan changes and reprovisioning. Sending "" clears it.
Bounds — the file is parsed by a root process on a machine shared with
BorealHost infrastructure, so only per-site proxy directives are accepted:
location, proxy_pass, proxy_set_header, proxy_http_version, proxy_*_timeout,
proxy_buffering, client_max_body_size, add_header, error_page, expires, gzip.
root, alias, include, access_log, error_log, server and upstream
are refused, and proxy_pass must target your own site's existing upstream.
A rejection names the directive and why.
The config is validated with nginx -t before it is applied and rolled back
automatically if it does not pass, so a mistake cannot take your site down.
Requires: API key with write scope.
Args: domain_name: Full domain name (e.g. "example.com") content: nginx config, or "" to clear it
Returns: {"domain": "example.com", "bytes": 214, "replaced": false}
Errors: NOT_FOUND: Domain not found VALIDATION_ERROR: Domain not linked to a site, a directive is not permitted, proxy_pass targets something other than your own upstream, or nginx rejected the config (the message says which)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| content | Yes | ||
| domain_name | Yes |