Localhost Access
Run web servers, APIs, and dashboards inside Lab and access them through a secure proxy.
How It Works
Services running in your Lab environment aren’t directly exposed to the internet. Instead, Calliope provides a secure proxy that lets you access them through your browser.
Recommended Ports
| Port Range | Status |
|---|---|
| 9000-9999 | Recommended for user apps |
| Other ports | May conflict with system services |
Accessing Your Service
If you start a service on port 9000, access it at:
https://your-workspace-url/proxy/9000/Replace the port number with your actual service port.
Examples
Flask App
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello():
return 'Hello from Lab!'
if __name__ == '__main__':
app.run(host='0.0.0.0', port=9000)Run in terminal: python app.py &
Access at: https://your-workspace-url/proxy/9000/
FastAPI
# main.py
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
def read_root():
return {"message": "Hello from Lab!"}Run: uvicorn main:app --host 0.0.0.0 --port 9001 &
Access at: https://your-workspace-url/proxy/9001/
Streamlit Dashboard
streamlit run my_app.py --server.port 9002 --server.headless true &Access at: https://your-workspace-url/proxy/9002/
Gradio Interface
import gradio as gr
def greet(name):
return f"Hello {name}!"
demo = gr.Interface(fn=greet, inputs="text", outputs="text")
demo.launch(server_name="0.0.0.0", server_port=9003)Access at: https://your-workspace-url/proxy/9003/
Node.js / Express
const express = require('express');
const app = express();
app.get('/', (req, res) => {
res.send('Hello from Lab!');
});
app.listen(9004, '0.0.0.0', () => {
console.log('Server running on port 9004');
});Access at: https://your-workspace-url/proxy/9004/
Voilà (Notebook Dashboard)
voila my_notebook.ipynb --port 9005 --no-browser --Voila.ip=0.0.0.0 &Access at: https://your-workspace-url/proxy/9005/
Suggested Port Assignments
| Service Type | Suggested Port |
|---|---|
| Flask / FastAPI | 9000 |
| Secondary API | 9001 |
| Streamlit | 9002 |
| Gradio | 9003 |
| Node.js | 9004 |
| Voilà | 9005 |
| Custom apps | 9006-9999 |
Tips
- Trailing slash: Always include the trailing slash (
/proxy/9000/not/proxy/9000) - Bind to 0.0.0.0: Configure your service to bind to
0.0.0.0, not justlocalhost - Relative paths: Use relative URLs in your app for assets and links
- WebSockets: Supported through the proxy
- Background processes: Use
&to run services in the background
Troubleshooting
Service not accessible?
# Check if service is running
lsof -i :9000
# Check service logsConnection refused?
- Ensure your service binds to
0.0.0.0(not127.0.0.1) - Most frameworks need explicit host configuration:
- Flask:
app.run(host='0.0.0.0') - FastAPI:
--host 0.0.0.0 - Streamlit: Uses
0.0.0.0by default
- Flask:
Assets not loading?
- Configure your app to use relative URLs
- Some frameworks need base URL/path configuration for proxied environments