✅ 障害復旧完了¶
実施した対処方法¶
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キー認証が正常に動作します。