操作
バグ #185
未完了task.call2arm.com Redmine UI設定画面 - APIキー認証失敗障害
開始日:
2025-06-04
期日:
進捗率:
0%
予定工数:
説明
障害概要¶
発生日時: 2025年6月4日
影響システム: task.call2arm.com/redmine-ui/settings
障害内容: 正式なAPIキー feb66d81a5f4ff9c585ce30fce2ac06e0554aec6
を入力しても認証に失敗
エラー症状: 502 Bad Gateway, /api/users/current.json へのリクエストが失敗
影響範囲¶
- task.call2arm.com のRedmine UI統合機能全体
- React アプリケーションからのRedmine API呼び出し全般
- 設定画面、ログイン画面、プロジェクト管理機能
障害の根本原因¶
1. nginx プロキシ設定の不備¶
-
/api/*
パスが task-ui:80 (Vue.js開発アプリ) にルーティングされていた - 本来は redmine-prod:3000 (本番Redmine) に送信する必要があった
2. Redmine APIパス不整合¶
- React アプリ:
/api/users/current.json
を要求 - Redmine 実際のパス:
/users/current.json
- nginx で
/api/
プレフィックス除去処理が未実装
3. CORS設定不備¶
- Redmine API呼び出し時のクロスオリジン設定が不完全
- 必要ヘッダー (X-Redmine-API-Key) の許可設定漏れ
検証済み事項¶
✅ APIキー有効性: call2arm.com では正常認証確認
✅ Redmine本番稼働状況: 正常
✅ ネットワーク接続: 正常
✅ SSL証明書: 有効
Redmine Admin さんが4日前に更新
✅ 障害復旧完了¶
実施した対処方法¶
1. nginx設定ファイル修正 (/root/nginx-proxy/conf.d/task-call2arm.conf
)¶
追加した設定:
# Redmine API エンドポイント - /api/ プレフィックス除去してredmine-prod に転送
location /api/ {
# CORS設定 - *.call2arm.comからのアクセス許可
set $cors "";
if ($http_origin ~* ^https?://[^/]+\.call2arm\.com(:[0-9]+)?$) {
set $cors "true";
}
if ($request_method = "OPTIONS") {
set $cors "${cors}options";
}
if ($cors = "trueoptions") {
add_header "Access-Control-Allow-Origin" "$http_origin" always;
add_header "Access-Control-Allow-Methods" "GET, POST, PUT, DELETE, OPTIONS" always;
add_header "Access-Control-Allow-Headers" "X-Redmine-API-Key, Content-Type, Authorization, x-api-key" always;
add_header "Access-Control-Allow-Credentials" "true" always;
add_header "Access-Control-Max-Age" 1728000;
add_header "Content-Type" "text/plain; charset=utf-8";
add_header "Content-Length" 0;
return 204;
}
if ($cors = "true") {
add_header "Access-Control-Allow-Origin" "$http_origin" always;
add_header "Access-Control-Allow-Credentials" "true" always;
add_header "Access-Control-Allow-Methods" "GET, POST, PUT, DELETE, OPTIONS" always;
add_header "Access-Control-Allow-Headers" "X-Redmine-API-Key, Content-Type, Authorization, x-api-key" always;
}
# 重要: /api/ プレフィックスを除去してRedmineに転送
rewrite ^/api/(.*) /$1 break;
proxy_pass http://redmine-prod:3000;
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-Port 443;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
}
2. 追加で対応したRedmineパス¶
-
/my/*
パス用の location ブロック追加 -
/users/*
パス用の location ブロック追加 - 各パスでCORS設定とredmine-prodプロキシ設定を統一
3. nginx設定適用¶
# 設定ファイル構文チェック
docker exec nginx-proxy nginx -t
# 設定リロード
docker exec nginx-proxy nginx -s reload
復旧確認結果¶
テスト実行:
# APIキー認証テスト
curl -H 'X-Redmine-API-Key: feb66d81a5f4ff9c585ce30fce2ac06e0554aec6' \
https://task.call2arm.com/api/users/current.json
結果:
{
"user": {
"id": 1,
"login": "admin",
"admin": true,
"firstname": "Redmine",
"lastname": "Admin",
"mail": "maki@now-working.info",
"api_key": "feb66d81a5f4ff9c585ce30fce2ac06e0554aec6",
"status": 1
}
}
確認済み動作エンドポイント¶
- ✅
https://task.call2arm.com/api/users/current.json
- ユーザー認証 - ✅
https://task.call2arm.com/api/my/account.json
- アカウント情報 - ✅
https://task.call2arm.com/api/projects.json
- プロジェクト一覧 - ✅
https://task.call2arm.com/api/issues.json
- チケット一覧 - ✅
https://task.call2arm.com/my/account.json
- 直接アクセス - ✅
https://task.call2arm.com/users/current.json
- 直接アクセス
障害復旧時刻¶
完了日時: 2025年6月4日 18:15 JST
復旧確認: 全APIエンドポイント正常動作確認済み
これで https://task.call2arm.com/redmine-ui/settings でのAPIキー認証が正常に動作します。
操作