-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathnginx.conf
More file actions
50 lines (45 loc) · 2.03 KB
/
Copy pathnginx.conf
File metadata and controls
50 lines (45 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
server {
listen 80;
server_name 9router.local; # Change to your domain
# Frontend (Static files if built, or proxy to Vite dev server)
# For production, you should build the frontend and serve it statically:
# root /path/to/AMRouter/frontend/dist;
# index index.html;
# location / {
# try_files $uri $uri/ /index.html;
# }
# Or proxy to frontend dev server (for dev environment)
location / {
proxy_pass http://127.0.0.1:5177;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
# Backend API and LLM proxy endpoints
location ~ ^/(api|v1|v1beta) {
proxy_pass http://127.0.0.1:3001;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
# Important for Server-Sent Events (SSE) streaming responses
proxy_buffering off;
proxy_cache off;
# A long answer (genspark MoA/agent runs, reasoning models) can stream for
# far longer than 5 minutes. When nginx times out mid-stream the client
# sees the response simply end — indistinguishable from a finished answer,
# which is the "answer stops by itself" symptom.
#
# Ordering matters: this must be LOOSER than every backend guard
# (GENSPARK_STALL_SEC=240s stall, PROVIDER_STALL_TIMEOUT_MS 600s router
# watchdog, GENSPARK_MAX_SEC=1800s ceiling). Whichever layer fires
# first decides what the client sees, and only the backend can report the
# cut honestly as finish_reason "length" — nginx can only drop the socket.
proxy_read_timeout 3600s;
proxy_send_timeout 3600s;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}