-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathnginx.datafoundry.conf.example
More file actions
99 lines (88 loc) · 2.88 KB
/
Copy pathnginx.datafoundry.conf.example
File metadata and controls
99 lines (88 loc) · 2.88 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# DataFoundry production / test reverse proxy
#
# Next keeps `compress: false` so AG-UI SSE (`/api/copilotkit`) is never gzip-
# buffered. Terminate TLS and compress static assets here instead.
#
# Usage sketch:
# upstream web -> next start :3000
# upstream api -> node API :8787
# browser -> this nginx :443 (or :80)
upstream datafoundry_web {
server 127.0.0.1:3000;
keepalive 32;
}
upstream datafoundry_api {
server 127.0.0.1:8787;
keepalive 32;
}
server {
listen 80;
server_name _;
# HTML + JS/CSS: compress aggressively for production first paint.
gzip on;
gzip_comp_level 5;
gzip_min_length 1024;
gzip_types
text/plain
text/css
text/javascript
application/javascript
application/json
application/xml
image/svg+xml;
gzip_vary on;
# Prefer brotli when the nginx brotli module is available.
# brotli on;
# brotli_comp_level 5;
# brotli_types text/plain text/css application/javascript application/json image/svg+xml;
# Liveness: process is up (may still be initializing).
location = /healthz {
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_pass http://datafoundry_api;
}
# Readiness: Mastra + builtin resources finished; safe to send traffic.
location = /ready {
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_pass http://datafoundry_api;
}
# Long-cache fingerprinted Next assets.
location /_next/static/ {
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header Host $host;
proxy_pass http://datafoundry_web;
add_header Cache-Control "public, max-age=31536000, immutable";
}
# CopilotKit / AG-UI SSE: never buffer or compress at the proxy.
location /api/copilotkit {
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffering off;
proxy_cache off;
gzip off;
proxy_read_timeout 3600s;
proxy_pass http://datafoundry_web;
}
# Same-origin BFF for password-mode cookies (Next proxies to API).
location /api/ {
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://datafoundry_web;
}
location / {
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://datafoundry_web;
}
}