fix(config): use internal app hostname for StatusPageApiInternalUrl#2565
Open
suvvvv wants to merge 1 commit into
Open
fix(config): use internal app hostname for StatusPageApiInternalUrl#2565suvvvv wants to merge 1 commit into
suvvvv wants to merge 1 commit into
Conversation
StatusPageApiInternalUrl is used for server-to-server (in-cluster) calls such as the status page SEO lookup the app makes about itself. It was built from AppApiClientUrl, which uses the public HOST and HTTP_PROTOCOL. In Kubernetes/multi-host deployments this makes the pod call its own public ingress, causing `APIException: ... connect ETIMEDOUT`. Build it from AppApiHostname (SERVER_APP_HOSTNAME:APP_PORT) over http instead, matching the internal-URL pattern already used by MailService, SmsService, etc. The /api/status-page path is unchanged, so only the host and protocol move from public to internal — which is what the existing comment on this constant already claimed it did. Adds tests asserting the internal URL uses the internal hostname (not the public host), targets /api/status-page, and stays on http even when the public protocol is https. Fixes OneUptime#2475 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
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.
What
StatusPageApiInternalUrlis used for server-to-server (in-cluster) calls — e.g. the status page SEO lookup the app makes about itself. It was built fromAppApiClientUrl, which uses the publicHOSTandHTTP_PROTOCOL:In Kubernetes / any multi-host deployment, the pod then tries to reach its own public ingress from the inside:
Fix
Build it from
AppApiHostname(SERVER_APP_HOSTNAME:APP_PORT) overhttp, matching the internal-URL pattern already used byMailService,SmsService,StatusPageCertificateService, etc.:The path stays
/api/status-page— only the host and protocol move from public to internal, which is exactly what the existing comment on this constant already claimed it did.Tests
New
Common/Tests/Server/EnvironmentConfig.test.ts(re-importsEnvironmentConfigwith controlled env viajest.resetModules()+import()):oneuptime-app:3002), not the publicHOST./api/status-pageinternal route.http://even whenHTTP_PROTOCOL=https(in-cluster traffic shouldn't go through TLS/ingress).Tests 1 and 3 fail without the source change, confirming they are real regression guards. Prettier-clean and type-checks pass.
Fixes #2475