update configuration docker setup for data platform
This commit is contained in:
88
01-infra/nginx-configs/supabase-kong.conf
Normal file
88
01-infra/nginx-configs/supabase-kong.conf
Normal file
@@ -0,0 +1,88 @@
|
||||
# Supabase Kong API Gateway - REST API
|
||||
# Subpath: /supabase-api
|
||||
# Backend: sdp-kong:8000
|
||||
|
||||
location /supabase-api {
|
||||
# Remove /supabase-api prefix before forwarding
|
||||
rewrite ^/supabase-api(/.*)$ $1 break;
|
||||
|
||||
# Forward to Kong Gateway
|
||||
proxy_pass http://sdp-kong:8000;
|
||||
|
||||
# Preserve headers
|
||||
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;
|
||||
proxy_set_header X-Forwarded-Host $host;
|
||||
|
||||
# API key and authorization headers
|
||||
proxy_set_header Authorization $http_authorization;
|
||||
proxy_set_header apikey $http_apikey;
|
||||
|
||||
# CORS headers (if needed)
|
||||
add_header Access-Control-Allow-Origin * always;
|
||||
add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, PATCH, OPTIONS" always;
|
||||
add_header Access-Control-Allow-Headers "Authorization, Content-Type, apikey, X-Client-Info" always;
|
||||
|
||||
# Handle preflight requests
|
||||
if ($request_method = 'OPTIONS') {
|
||||
return 204;
|
||||
}
|
||||
|
||||
# Timeouts for API calls
|
||||
proxy_connect_timeout 30s;
|
||||
proxy_send_timeout 30s;
|
||||
proxy_read_timeout 30s;
|
||||
|
||||
# Disable buffering for streaming responses
|
||||
proxy_buffering off;
|
||||
}
|
||||
|
||||
# REST API endpoints
|
||||
location /supabase-api/rest {
|
||||
rewrite ^/supabase-api(/.*)$ $1 break;
|
||||
proxy_pass http://sdp-kong:8000;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header Authorization $http_authorization;
|
||||
proxy_set_header apikey $http_apikey;
|
||||
}
|
||||
|
||||
# Auth endpoints
|
||||
location /supabase-api/auth {
|
||||
rewrite ^/supabase-api(/.*)$ $1 break;
|
||||
proxy_pass http://sdp-kong:8000;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header Authorization $http_authorization;
|
||||
proxy_set_header apikey $http_apikey;
|
||||
}
|
||||
|
||||
# Storage endpoints
|
||||
location /supabase-api/storage {
|
||||
rewrite ^/supabase-api(/.*)$ $1 break;
|
||||
proxy_pass http://sdp-kong:8000;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header Authorization $http_authorization;
|
||||
proxy_set_header apikey $http_apikey;
|
||||
|
||||
# Larger timeouts for file uploads
|
||||
proxy_connect_timeout 300s;
|
||||
proxy_send_timeout 300s;
|
||||
proxy_read_timeout 300s;
|
||||
client_max_body_size 100M;
|
||||
}
|
||||
|
||||
# Realtime endpoints (WebSocket)
|
||||
location /supabase-api/realtime {
|
||||
rewrite ^/supabase-api(/.*)$ $1 break;
|
||||
proxy_pass http://sdp-kong:8000;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header Authorization $http_authorization;
|
||||
proxy_set_header apikey $http_apikey;
|
||||
|
||||
# WebSocket support
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_read_timeout 86400;
|
||||
}
|
||||
Reference in New Issue
Block a user