Files
ewoooc/docker/superset/nginx-superset.conf
ogt 1b4f3a7bbe
Some checks failed
CD Pipeline / deploy (push) Failing after 59s
feat: EwoooC 初始化 — 完整專案推版至 Gitea
- 建立 Gitea Actions CD pipeline (.gitea/workflows/cd.yaml)
- 部署模式: rsync Python 檔案至 188 → docker restart (volume mount)
- Dockerfile/requirements 變動時自動重建 Docker image
- 部署通知: Telegram (開始/成功/失敗)
- 健康檢查: https://mo.wooo.work/health (最多 5 次重試)
- 同步最新 CLAUDE.md / ADR-008 / memory (2026-04-19)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-19 01:21:13 +08:00

119 lines
4.0 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# =============================================================================
# Nginx 反向代理配置 - Apache Superset
# 複製此配置到 /etc/nginx/sites-available/superset
# =============================================================================
# 將此內容加入到 monitor.wooo.work 的 server 區塊中
# 2026-02-08 更新:修復登入重定向問題
# =============================================================================
# 關鍵設定 0重定向 Superset 相關路徑
# 解決 Superset 生成的 URL 沒有 /superset/ 前綴的問題
# =============================================================================
# 認證相關路徑重定向
location = /login/ {
return 302 /superset/login/;
}
location = /logout/ {
return 302 /superset/logout/;
}
# 語言切換路徑重定向
location ^~ /lang/ {
return 302 /superset$request_uri;
}
# 用戶資訊路徑重定向
location ^~ /users/ {
return 302 /superset$request_uri;
}
# 靜態資源路徑重定向 (SPA 動態載入)
location ^~ /static/ {
return 302 /superset$request_uri;
}
# Superset BI 分析平台
# 重要Superset 內部路由已是 /superset/...,不需要再添加前綴
# 2026-02-08 更新:修復雙重前綴問題 (/superset/superset/)
location /superset/ {
proxy_pass http://127.0.0.1:8088/;
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 X-Forwarded-Proto $scheme;
# 注意:不設置 X-Forwarded-Prefix 和 X-Script-Name
# 因為 superset_config.py 中 x_prefix=0Superset 不讀取這些標頭
# 關鍵設定 1Superset 內部路由已是 /superset/,保持不變
# 只對非 /superset/ 開頭的路徑添加前綴
proxy_redirect /superset/ /superset/;
proxy_redirect ~^/(?!superset)(.*)$ /superset/$1;
# 關鍵設定 2禁用 gzip 壓縮,讓 sub_filter 可以正常運作
proxy_set_header Accept-Encoding "";
gzip off;
# 關鍵設定 3重寫 HTML 中的 URL
# 只處理靜態資源路徑(不處理 href/action避免重複添加
sub_filter '"/static/' '"/superset/static/';
sub_filter "'/static/" "'/superset/static/";
sub_filter_once off;
sub_filter_types text/html application/javascript text/javascript text/css;
# WebSocket 支援 (SQL Lab 需要)
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
# 超時設定 (SQL Lab 查詢可能較長)
proxy_connect_timeout 300;
proxy_send_timeout 300;
proxy_read_timeout 300;
# 緩衝設定
proxy_buffering on;
proxy_buffer_size 4k;
proxy_buffers 8 4k;
}
# Superset 靜態資源 (可選,提升效能)
location /superset/static/ {
proxy_pass http://127.0.0.1:8088/static/;
proxy_cache_valid 200 1d;
proxy_cache_valid any 1m;
expires 1d;
add_header Cache-Control "public, immutable";
}
# =============================================================================
# 或者使用獨立的 server 區塊 (superset.wooo.work)
# =============================================================================
# server {
# listen 443 ssl http2;
# server_name superset.wooo.work;
#
# ssl_certificate /etc/letsencrypt/live/superset.wooo.work/fullchain.pem;
# ssl_certificate_key /etc/letsencrypt/live/superset.wooo.work/privkey.pem;
#
# location / {
# proxy_pass http://127.0.0.1:8088;
# 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 X-Forwarded-Proto $scheme;
#
# # WebSocket 支援
# proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection "upgrade";
#
# # 超時設定
# proxy_connect_timeout 300;
# proxy_send_timeout 300;
# proxy_read_timeout 300;
# }
# }