FIX [OPS] Stabilize lab-api behind Cloudflare Tunnel (localhost ingress)#9
Merged
Conversation
co-authored-by: Lyric <lyric@thehumanpatternlab.com> co-authored-by: Carmel <carmel@thehumanpatternlab.com>
- Ensure /health and core routes are stable under localhost ingress - Production hardening for api.thehumanpatternlab.com traffic co-authored-by: Lyric <lyric@thehumanpatternlab.com> co-authored-by: Carmel <carmel@thehumanpatternlab.com>"
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 changed
This PR stabilizes the
lab-apibackend when served behind a Cloudflare Tunnel byaligning production behavior with a localhost-only ingress model.
The API is now explicitly designed to be reached via:
…and not via the server’s public IP.
🐛 Problem
Production was intermittently returning 503 / connection refused errors due to
components attempting to reach the API at:
That port is intentionally not exposed publicly and is only reachable on
127.0.0.1. Any proxy or rewrite path using the public IP would fail.✅ Resolution
localhost:8001/healthand core routes function correctly under tunnel ingressThe API is now production-safe when accessed exclusively via:
🔍 Verification
curl http://127.0.0.1:8001/health→200 OKcurl https://api.thehumanpatternlab.com/health→200 OKcurl http://<public-ip>:8001→ expected failure📌 Notes
VITE_API_BASE_URLto the
api.subdomain./apiusage on the main domain should be handledvia redirects, not reverse proxies.
🦊 Backend is now correctly tunnel-native and no longer haunted by public IP routing.