-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnginx.conf
More file actions
71 lines (61 loc) · 2.25 KB
/
nginx.conf
File metadata and controls
71 lines (61 loc) · 2.25 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
worker_processes auto;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml;
server {
listen 3000;
server_name _;
# Allow large file uploads (matches API's 50MB limit)
client_max_body_size 50m;
root /usr/share/nginx/html;
index index.html;
# WebSocket upgrade for /api/ws/
location /api/ws/ {
proxy_pass http://api:8000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
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-API-Key "${CARDIGAN_API_KEY}";
proxy_read_timeout 86400;
}
# API proxy
location /api/ {
proxy_pass http://api:8000;
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-API-Key "${CARDIGAN_API_KEY}";
}
# MCP Streamable HTTP endpoint (optional — for Claude Desktop via Docker)
# Uses variable + resolver so nginx starts even when mcp service is not running
location /mcp/ {
resolver 127.0.0.11 valid=30s;
set $mcp_upstream http://mcp:8080;
proxy_pass $mcp_upstream/mcp/;
proxy_buffering off;
proxy_cache off;
proxy_http_version 1.1;
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 Connection '';
# Streaming support for server-initiated events
chunked_transfer_encoding on;
proxy_read_timeout 3600;
}
# SPA fallback — serve index.html for all other routes
location / {
try_files $uri $uri/ /index.html;
}
}
}