Files
archy/packages/app/server/nginx-archy.conf
T

62 lines
1.9 KiB
Plaintext
Raw Normal View History

# AIUI nginx config for Archipelago deployment
# Include this in your Archy nginx server block.
#
# Prerequisites:
# - AIUI built and placed in /opt/archipelago/web-ui/aiui/
# - Set $anthropic_api_key in nginx or via env (see below)
#
# Usage in nginx.conf:
# include /opt/archipelago/web-ui/aiui/nginx-archy.conf;
# Serve AIUI SPA
location /aiui/ {
alias /opt/archipelago/web-ui/aiui/;
try_files $uri $uri/ /aiui/index.html;
# Cache static assets aggressively
location ~* /aiui/assets/ {
expires 1y;
add_header Cache-Control "public, immutable";
}
}
# Proxy Claude API requests from AIUI iframe
# AIUI fetches /api/claude/v1/messages → proxied to Anthropic API
location /aiui/api/claude/ {
# Rewrite: strip /aiui/api/claude prefix, forward to Anthropic
rewrite ^/aiui/api/claude/(.*)$ /$1 break;
proxy_pass https://api.anthropic.com;
proxy_ssl_server_name on;
proxy_set_header Host api.anthropic.com;
proxy_set_header x-api-key $anthropic_api_key;
proxy_set_header anthropic-version "2023-06-01";
proxy_set_header Content-Type "application/json";
# SSE streaming support
proxy_buffering off;
proxy_cache off;
proxy_read_timeout 300s;
proxy_http_version 1.1;
proxy_set_header Connection "";
# Security: only allow from same origin (AIUI iframe)
# The iframe has sandbox="allow-same-origin" so requests come from Archy's origin
}
# Proxy OpenRouter API requests (optional, for multi-model support)
location /aiui/api/openrouter/ {
rewrite ^/aiui/api/openrouter/(.*)$ /api/v1/chat/completions break;
proxy_pass https://openrouter.ai;
proxy_ssl_server_name on;
proxy_set_header Host openrouter.ai;
proxy_set_header Content-Type "application/json";
proxy_buffering off;
proxy_cache off;
proxy_read_timeout 300s;
proxy_http_version 1.1;
proxy_set_header Connection "";
}