Refactor StatusPage API integration to use internal URL for server-to-server communication

This commit is contained in:
Nawaz Dhandala 2026-01-08 13:05:24 +00:00
parent a08700e9f5
commit 8826635920
No known key found for this signature in database
GPG key ID: 96C5DCA24769DBCA
3 changed files with 13 additions and 6 deletions

View file

@ -397,6 +397,13 @@ export const StatusPageApiClientUrl: URL = new URL(
new Route(StatusPageApiRoute.toString()),
);
// Internal URL for server-to-server communication (uses internal Docker hostname)
export const StatusPageApiInternalUrl: URL = new URL(
Protocol.HTTP,
AppApiHostname.toString(),
new Route(StatusPageApiRoute.toString()),
);
export const DashboardClientUrl: URL = new URL(
HttpProtocol,
Host,

View file

@ -2,7 +2,7 @@ import { ExpressRequest, ExpressResponse } from "Common/Server/Utils/Express";
import API from "Common/Utils/API";
import {
HttpProtocol,
StatusPageApiClientUrl,
StatusPageApiInternalUrl,
} from "Common/Server/EnvironmentConfig";
import URL from "Common/Types/API/URL";
import HTTPErrorResponse from "Common/Types/API/HTTPErrorResponse";
@ -39,7 +39,7 @@ export const handleRSS: (
// Fetch incidents
const incidentsResponse: HTTPErrorResponse | HTTPResponse<JSONObject> =
await API.post({
url: URL.fromString(StatusPageApiClientUrl.toString()).addRoute(
url: URL.fromString(StatusPageApiInternalUrl.toString()).addRoute(
`/incidents/${statusPageId}`,
),
data: {},
@ -51,7 +51,7 @@ export const handleRSS: (
// Fetch announcements
const announcementsResponse: HTTPErrorResponse | HTTPResponse<JSONObject> =
await API.post({
url: URL.fromString(StatusPageApiClientUrl.toString()).addRoute(
url: URL.fromString(StatusPageApiInternalUrl.toString()).addRoute(
`/announcements/${statusPageId}`,
),
data: {},
@ -63,7 +63,7 @@ export const handleRSS: (
// Fetch scheduled maintenance
const scheduledResponse: HTTPErrorResponse | HTTPResponse<JSONObject> =
await API.post({
url: URL.fromString(StatusPageApiClientUrl.toString()).addRoute(
url: URL.fromString(StatusPageApiInternalUrl.toString()).addRoute(
`/scheduled-maintenance-events/${statusPageId}`,
),
data: {},

View file

@ -1,6 +1,6 @@
import { ExpressRequest } from "Common/Server/Utils/Express";
import API from "Common/Utils/API";
import { StatusPageApiClientUrl } from "Common/Server/EnvironmentConfig";
import { StatusPageApiInternalUrl } from "Common/Server/EnvironmentConfig";
import URL from "Common/Types/API/URL";
import HTTPErrorResponse from "Common/Types/API/HTTPErrorResponse";
import HTTPResponse from "Common/Types/API/HTTPResponse";
@ -65,7 +65,7 @@ export const getStatusPageData: (
);
const response: HTTPErrorResponse | HTTPResponse<JSONObject> =
await API.get({
url: URL.fromString(StatusPageApiClientUrl.toString()).addRoute(
url: URL.fromString(StatusPageApiInternalUrl.toString()).addRoute(
`/seo/${statusPageIdOrDomain}`,
),
});