Skip to content

Commit 3c7edc9

Browse files
committed
feat: Add a warning about enabling local network access when relevant
If you’re trying to connect to a 127.0.0.1 or localhost instance or cluster from Fabric, and the health check isn’t responding… we can guide the user a bit more! Yay. https://harperdb.atlassian.net/browse/STUDIO-592
1 parent 157bf1c commit 3c7edc9

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/features/auth/ClusterInstanceSignIn.tsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ export function ClusterInstanceSignIn() {
5454
}, [cluster, instance]);
5555

5656
const instanceParams = useInstanceClientIdParams(operationsUrl);
57+
const warnAboutLocalDeviceAccess = useMemo(
58+
() => operationsUrl?.includes('localhost') || operationsUrl?.includes('127.0.0.1'),
59+
[operationsUrl],
60+
);
5761
const warnAboutLoginCookieIssues = useMemo(
5862
() => detectCrossLocalhostUrls(navigator.userAgent, location.hostname, operationsUrl),
5963
[operationsUrl],
@@ -140,9 +144,17 @@ export function ClusterInstanceSignIn() {
140144
{healthy === false && (
141145
<div className="p-4 mt-4 text-sm text-yellow-800 rounded-lg bg-yellow-50 dark:bg-gray-800 dark:text-yellow-300" role="alert">
142146
<span className="font-medium">Warning!</span> This {commonNoun} is not responding to
143-
GET {operationsUrl}health. Is the server running? Have
144-
you <a href="https://docs.harperdb.io/docs/developers/security/configuration#cors" target="_blank" className="underline">enabled
145-
CORS</a> for the operations API?
147+
GET <a href={`${operationsUrl}health`} className="underline" target="_blank">{operationsUrl}health</a> checks.
148+
<ol className="list-decimal ml-8 mt-2">
149+
<li>Is the server running?</li>
150+
<li>Have you <a
151+
href="https://docs.harperdb.io/docs/developers/security/configuration#cors" target="_blank"
152+
className="underline">enabled CORS</a> for the operations API?
153+
</li>
154+
{warnAboutLocalDeviceAccess && <li>Have you allowed <a
155+
href="https://www.google.com/search?q=How+do+I+enable+local+network+access+in+my+browser%3F" className="underline" target="_blank">local
156+
network access</a> in your browser?</li>}
157+
</ol>
146158
</div>
147159
)}
148160
{warnAboutLoginCookieIssues === CrossLocalhostIssueType.MixedLoopback && (

0 commit comments

Comments
 (0)