Repository navigation
fix(edge): serve an Openship page for upstream-down 502/504 instead of OpenResty's stock one - #557
Merged
Hydralerne merged 3 commits intoSep 16, 2026
Conversation
The edge defined no `error_page` for any 5xx, so an app that was restarting, crashed, or still booting produced OpenResty's stock `502 Bad Gateway`. Behind Openship Cloud's shared edge — which forwards to the box by IP and relays whatever the box answers — that page is what a visitor to the operator's OWN domain reads, branded for a third party. Closes oblien#556. Adds the page as `edge-upstream-down.ts`, mirroring the unrouted-host page (oblien#431): inline in the config for the same reason (it has to arrive on every install path at once, and a missing `include` would be a hard `-t` failure that freezes every later reload), the same five tokenizer invariants, and no links or reflected values since it is served to strangers. Removing the third-party link IS the fix — re-pointing it at the operator's own domain would only link to the site that is currently down. Wired at server scope in every vhost that proxies to an upstream: not host redirects, and not static routes unless a compiled vercel.json gave them proxy locations. Intercepts 502 and 504 only — `blockStatus` (403) and `rateLimit.status` (429) are operator-overridable, so a 503 arm would brand a deliberate block as an outage. `VHOST_GENERATION` 1 -> 2, without which this reaches no existing box: `registerRoute` is the sole writer, and `reapplyStoredRoutes` replays only vhosts stamped below the current generation. No `=` before the named location, so an intercepted 504 stays a 504 and one body serves both codes. Verified against openresty/openresty:1.27.1.1-alpine rather than assumed: with `=`, the named location's own return code replaces the original and a timeout stops being reportable as one. Verified: a new e2e boots real OpenResty with vhosts from the real NginxProvider and checks a refused upstream (502 + our page), a read timeout (504 + our page), an app's own 502 (its body passes through untouched, since `proxy_intercept_errors` is off), a healthy app, a `.css` URI on a down app, and a static vhost. Three of its six cases fail without this change, returning the stock pages. Full adapters suite: 2879 pass.
AbdullahM07
force-pushed
the
fix/edge-upstream-down-page
branch
from
August 16, 2026 11:51
4743cdd to
394c06b
Compare
Hydralerne
changed the base branch from
main
to
feat/bugfix-batch-2026-09-16
September 16, 2026 01:59
Hydralerne
merged commit Sep 16, 2026
90dd868
into
oblien:feat/bugfix-batch-2026-09-16
8 checks passed
This was referenced Sep 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a routed application stops answering, the host edge now serves an “Application unavailable” page for its own 502/504 responses. It preserves the HTTP status, leaves application-generated error responses unchanged, and covers proxy locations on otherwise static sites. Redirect-only and static-only routes keep their existing behavior.
Generation 3 upgrades saved generation-2 routes through the existing route replay mechanism. The page has no external links or reflected request values. This covers an available host with an unavailable application; errors generated by the separate Cloud edge when the host itself is unreachable are outside this repository.
Validation: 200 adapter/config tests and six real OpenResty cases pass, with API TypeScript passing. Three real HTTP cases and the existing-route upgrade regression fail against current main. The original contributor commit is retained, with the current architecture merged in and the test transport adapted to the current container-edge reload contract.
Fixes #556.