Raseef Private Networking: Why Browsers Cannot Reach Internal APIs
Connect Raseef services privately, separate browser and server requests, and troubleshoot DNS, ports, TLS and CORS with a reproducible Node.js probe.
·
Why does the API work from your app but not from the browser?
A private API can be healthy and still be unreachable from a customer's laptop. The deciding factor is where the request runs, not which repository contains the code. Server-side code in a Raseef service and JavaScript downloaded into a browser are different network clients.
For a team splitting a web application into a public frontend and an internal API, the useful design is usually: browser → public web backend → private API. This guide explains how to configure that path, verify it without exposing customer data, and distinguish networking failures from application errors.
Evidence and scope: the platform steps below were checked against Raseef's current public documentation on 26 November 2026. The acceptance test is a reproducible procedure, not a claim that we ran it in a customer environment. The cover is a generated conceptual illustration, not a console screenshot or network trace.
1. Choose the request path before changing settings
Raseef's private-network documentation scopes connectivity to services in the same environment. Other environments, other projects and the public internet cannot reach the private address.
- A backend in the same environment can call the API's private address and listening port.
- A browser cannot reach that address merely because Raseef serves the JavaScript file.
- A local development process is also outside that environment.
- A static frontend with no server-side component cannot itself relay requests privately.
If a browser needs API data, use an authenticated server-side endpoint that calls the private service and returns only authorized data. Alternatively, deliberately publish an HTTPS API and implement authentication, authorization and the required browser-origin policy. Do not make a service public just to make a connectivity test pass.
For a static-only application, adding a backend is an architectural change, not a CORS setting. Private networking also does not replace service authentication or per-user authorization.
2. Give the internal API a private port
Assume two services named web and api in one environment. Use a test environment with no production records.
- Make the API listen on all interfaces,
0.0.0.0, rather than only localhost. - Under the API's Networking, set Private port → Listen on a port and enter the actual listening port.
- Deploy the API. Confirm its startup logs and the Private address panel; the documentation describes Reachable while the service runs.
- Keep the API private unless a separate requirement calls for public access.
For GitHub-built services, Raseef supplies PORT (8080 by default); a value you set overrides it. Image services do not receive PORT automatically. Match the process's real port to the configured private port rather than assuming the two agree.
A minimal disposable test target, saved as probe-api.cjs, is:
const http = require('node:http');
const port = Number(process.env.PORT || 8080);
http.createServer((req, res) => {
if (req.method !== 'GET' || req.url !== '/internal-ping') {
res.writeHead(404);
return res.end();
}
res.writeHead(200, { 'Content-Type': 'application/json' });
res.end(JSON.stringify({ service: 'api', ok: true }));
}).listen(port, '0.0.0.0');Start it with node probe-api.cjs. This endpoint contains no customer data and is not a production authentication example. Remove the disposable service when testing is complete.
3. Reference the address from the consuming service
In Variables for web, add these separate values:
API_HOST=${{ api.RASEEF_PRIVATE_DOMAIN }}
API_PORT=${{ api.RASEEF_PRIVATE_PORT }}Then deploy web. Do not paste a hostname copied from an earlier deployment or place private connection settings in a browser bundle.
Raseef resolves references at deployment time. Saving variables does not change a running process, and restarting preserves the current deployment's resolved values. See the focused save, deploy and restart guide if an old value persists.
For the plain HTTP service above, construct http://host:port, not https://host:port. Private traffic bypasses Raseef's public gateway; the gateway's HTTPS termination is not attached to that private endpoint. There is a documentation inconsistency worth noticing: the variables page includes an HTTPS private-URL example, while the dedicated networking page explicitly says to use HTTP. Follow the actual protocol your process serves and the networking guidance for this example; do not disable certificate verification to mask a protocol mismatch.
4. Run a bounded server-side probe
Save the following as probe-client.cjs in the consuming service's source. Use a supported Node.js runtime with built-in fetch and AbortSignal.timeout (see the Node.js globals reference). Run it from a process in the same Raseef environment, for example as the start command of a disposable test consumer with the variables above. This does not require assuming an undocumented console-shell feature.
async function main() {
const host = process.env.API_HOST;
const port = Number(process.env.API_PORT);
if (!host || !Number.isInteger(port) || port < 1 || port > 65535) {
throw new Error('Missing or invalid private endpoint configuration');
}
const url = new URL('http://localhost/internal-ping');
url.hostname = host;
url.port = String(port);
const response = await fetch(url, {
signal: AbortSignal.timeout(5000),
redirect: 'error'
});
if (!response.ok) throw new Error('Upstream HTTP ' + response.status);
const body = await response.json();
if (body.service !== 'api' || body.ok !== true) {
throw new Error('Unexpected probe response');
}
console.log('PRIVATE_API_PROBE_OK');
}
main().catch(error => {
console.error(error.name, error.cause?.code || 'PROBE_FAILED');
process.exitCode = 1;
});The five-second timeout is a chosen test budget, not a Raseef latency measurement or limit. The fixed destination and path deliberately avoid accepting a user-supplied URL. Do not turn a production relay into an open proxy.
Expected success is a single PRIVATE_API_PROBE_OK line. A one-shot consumer may exit successfully without becoming a continuously running web service; use its process result and logs for this test, not a public readiness badge. In production, handle upstream errors inside your normal request handler, authenticate the caller, authorize the requested resource and avoid returning internal addresses or error stacks.
5. Record a small acceptance matrix
Keep the commit, runtime version, environment and service names, configured ports, deployment identifiers, timestamp and sanitized result for each case:
- Same-environment consumer: the correct private host and port should return the known JSON body.
- Wrong port in the test consumer: the request should fail, not hang indefinitely. Record the observed error instead of assuming one exact operating-system code.
- Browser or local laptop: the private endpoint should not be usable. A DNS failure, timeout or browser block alone does not independently prove isolation.
- Real browser journey through the public backend: verify both an authorized response and a denied request for a user who lacks access.
- Configuration change: change only the disposable test settings, deploy the consumer again and repeat. Do not disrupt production networking to test failure handling.
These are acceptance criteria, not measured results. Avoid copying credentials, complete connection strings or private customer responses into your evidence.
6. Troubleshoot from the inside out
Name-resolution error: confirm the caller actually runs in the intended environment, the reference uses the correct service, and the consumer has been redeployed. Do not “fix” a private address by putting it into public DNS.
Connection refused: check the target process, private-port setting and bind address. A process listening on localhost cannot accept requests arriving at another interface.
Timeout: check service availability, environment boundaries and application behavior. Private traffic has none of the public gateway's timeouts, but your client, application and infrastructure can still time out. Always set an application-level deadline.
TLS or protocol error: confirm whether the destination actually serves TLS. The test server above serves plain HTTP. A public HTTPS URL and a private HTTP endpoint are not interchangeable.
HTTP 401 or 403: the request reached an HTTP responder; inspect authentication and authorization rather than removing them. A 404 can mean the wrong path or service.
Browser CORS or mixed-content message: first check the browser's request URL. CORS does not create a route into a private network. Relay through the public backend, or use a deliberately public HTTPS API with an appropriate origin policy.
Works until a public proxy rule is added: private calls bypass the gateway. Do not assume public forwarding headers are present or trustworthy on a direct internal request. See the separate HTTPS and proxy-trust guide.
7. Know what this design does not promise
The public HTTP documentation says public exposure supports HTTP/HTTPS, not arbitrary raw TCP or UDP. Enabling Public HTTP is therefore not a way to publish a PostgreSQL socket. Database clients need the correct database protocol and credentials; an HTTP probe cannot validate database queries.
Private connectivity limits the network path. It does not by itself establish encryption in transit, compliance, end-user permissions, query correctness or availability guarantees. Bypassing a public gateway also does not prove that an application is faster: make that claim only after a controlled measurement.
For the first deployment rather than a split-service setup, start with the GitHub deployment guide.
Try the design with your own workload
Raseef is currently in private pilot. Request access and describe the public entry point, private dependencies and environment separation your application needs.
Sources
- Raseef private network: environment scope, private ports, address references and protocol.
- Raseef variables: deployment-time resolution and runtime variables.
- Raseef quickstart: bind address and application setup.
- Raseef public HTTP: public exposure and gateway behavior.
- Node.js globals: fetch and abort signals.