Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/demo/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ async def index(request):
async def ws_handler(request):
if ROLE != "realtime":
raise web.HTTPNotFound()
ws = web.WebSocketResponse(heartbeat=30)
ws = web.WebSocketResponse(heartbeat=30, max_msg_size=1024 * 1024)
await ws.prepare(request)
async for msg in ws:
if msg.type == WSMsgType.TEXT:
Expand Down
4 changes: 3 additions & 1 deletion nginx/conf.d/edge.conf
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ server {
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_read_timeout 1h;
proxy_send_timeout 60s;
proxy_max_temp_file_size 0;
proxy_pass http://realtime_pool;
}

Expand All @@ -54,7 +56,7 @@ server {
listen 8081;
server_name _;
access_log off;
location = /health { return 200 'ok\n'; }
location = /health { default_type text/plain; return 200 'ok\n'; }
location = /stub_status { stub_status; }
location / { return 404; }
}
9 changes: 8 additions & 1 deletion tests/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,16 @@ def test_metrics_port_isolation(self):
edge_cfg = load('nginx/conf.d/edge.conf')
self.assertIn('listen 8081;', edge_cfg)
self.assertIn('location = /stub_status { stub_status; }', edge_cfg)
self.assertIn('location = /health { return 200 \'ok\\n\'; }', edge_cfg)
self.assertIn("location = /health { default_type text/plain; return 200 'ok\\n'; }", edge_cfg)
self.assertIn('location / { return 404; }', edge_cfg)

def test_websocket_frame_and_proxy_buffering_bounds(self):
edge_cfg = load('nginx/conf.d/edge.conf')
self.assertIn('proxy_max_temp_file_size 0;', edge_cfg)
self.assertIn('proxy_send_timeout 60s;', edge_cfg)
source = load('apps/demo/app.py')
self.assertIn('max_msg_size=1024 * 1024', source)

def test_http_redirect_preserves_uri(self):
edge_cfg = load('nginx/conf.d/edge.conf')
self.assertIn('listen 80 default_server;', edge_cfg)
Expand Down
Loading